Hi Woodgnome,
Are you still focus on this issue? I've just got some new info. I've
discussed with a DEV engineer who has ever worked on a similar issue, here
is a workaround for mobile page to use the fileupload control. See the
following comments
==================================
The reason upload control can't work on mobile page is the result rendered
by mobile page is lacking a form property: enctype="multipart/form-data".
To inject this property you can inherit Html/Chtml/XhtmlMobileTextWriter
class and override their WriteBeginTag method. The override method is
something link below:
public class ChtmlMobileMultipartTextWriter :
System.Web.UI.MobileControls.Adapters.ChtmlMobileTextWriter
{
public ChtmlMobileMultipartTextWriter(System.IO.TextWriter writer,
MobileCapabilities device)
: base(writer, device)
{
}
public override void WriteBeginTag(string tag)
{
if (tag == null)
{
throw new ArgumentNullException("tag");
}
base.WriteBeginTag(tag);
if (tag.Equals("form"))
{
WriteAttribute("enctype", "multipart/form-data");
}
}
}
==============================
Hope this still helps.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
X-Tomcat-ID: 34003249
References: <
[email protected]>
<B5gE#
[email protected]>
<
[email protected]>
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
From: (e-mail address removed) (Steven Cheng[MSFT])
Organization: Microsoft
Date: Wed, 29 Aug 2007 03:00:00 GMT
Subject: RE: FileUpload Control on Mobile Form
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
Message-ID: <
[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
Lines: 120
Path: TK2MSFTNGHUB02.phx.gbl
Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:2222
NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
Hi Woodgnome,
Thanks for your reply.
Yes, a standard html based ASP.NET page will save much effort. Anyway, I'm
still doing some further research on this and will inform you if I get any
new information helpful.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:2217
NNTP-Posting-Host: tk2msftsbfm01.phx.gbl 10.40.244.148
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
Steven,
Thanks for the reply. The initial target devices are HTML enabled - but
the
intention was to make the pages available to more devices at a later date.
I will investigate using a standard asp.net page for now.
Thanks.
Woodgnome.
:
Hi Woodgnome,
Regarding on the ASP.NET mobile page fileuploading issue, I've
performed
some local tests and did found the same behavior as you mentioned. It
seems
the Mobile Form doesn't allow us to insert our custom attributes into
it
like a standard htmlForm control. I've also tried manually add the
"enctype="multipart/form-data" " attribute into the mobile form and it
was
also ignored and runtime. BTW, for mobile devices, I notice that few
WAP
or xhtml mp devices support file upload element,
http://www.developershome.com/wap/wapUpload/wap_upload.asp?page=intro
so are your web application's target devices HTML enabled? If so,
maybe
you can consider use a standard ASP.NET page(not mobile page) to serve
the
fileupload functionality(since only a simple screen with some text and
file
upload html element are necessary), how do you think?
Anyway, I'll also help you consult some other mobile engineers to see
whether there is anything else we can do here, I'll inform you as soon
as I
get any update.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#not
i
f
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each
follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach
the
most efficient resolution. The offering is not appropriate for
situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are
best
handled working with a dedicated Microsoft Support Engineer by
contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
Hi,
I am trying to provide the user with a file upload facility on mobile
devices that will support it. So I have tried using the FileUpload
control
in
a device specific section - as follows, but when the form posts back,
the
HasFile proerty is always set to false and the file is nowhere to be
seen.
It would appear that it may be something to do with the fact that the
form
is
rendering without enctype="multipart/form-data" on the form tag.
Anyone
any
ideas how I might get this to work ?
<mobile:Form ID="NewForm" runat="server" Title="New Form">
<mobile
eviceSpecific ID="DeviceSpecific1" Runat="Server">
<Choice>
<FooterTemplate>
<tr>
<td>
<asp:FileUpload ID="fileUpload1"
runat="server"></asp:FileUpload>
</br>
<asp:FileUpload ID="fileUpload2"
runat="server"></asp:FileUpload>
</br>
<asp:FileUpload ID="fileUpload3"
runat="server"></asp:FileUpload>
</td>
</tr>
</FooterTemplate>
</Choice>
</mobile
eviceSpecific>
......