|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
RE: FileUpload Control on Mobile FormAre 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 <B5gE#lF6HHA.5***@TK2MSFTNGHUB02.phx.gbl> >References: <7A4749E1-C6CF-4E97-9433-91700D58D***@microsoft.com> <FBD0A78F-C4A5-419C-BB20-315150882***@microsoft.com> >MIME-Version: 1.0 microsoft.public.dotnet.framework.aspnet.webcontrols:2222>Content-Type: text/plain >Content-Transfer-Encoding: 7bit >From: stch***@online.microsoft.com (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: <e4ta4ie6HHA.4***@TK2MSFTNGHUB02.phx.gbl> >Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols >Lines: 120 >Path: TK2MSFTNGHUB02.phx.gbl >Xref: TK2MSFTNGHUB02.phx.gbl Show quote >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. >> >> >> >>"Steven Cheng[MSFT]" wrote: >> >>> 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#noti 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:DeviceSpecific 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:DeviceSpecific> >>> > >>> >...... >>> > >>> >>> >> > > Hi Woodgnome,
Does the further info in my last reply helps? If there is anything else we can help, please feel free to post here. Sincerely, Steven Cheng Microsoft MSDN Online Support Lead This posting is provided "AS IS" with no warranties, and confers no rights. -------------------- >Date: Fri, 31 Aug 2007 04:02:44 GMT ing-Host: tomcatimport2.phx.gbl 10.201.218.182>Subject: RE: FileUpload Control on Mobile Form >>Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols Show quote > >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: <7A4749E1-C6CF-4E97-9433-91700D58D***@microsoft.com> ><B5gE#lF6HHA.5***@TK2MSFTNGHUB02.phx.gbl> ><FBD0A78F-C4A5-419C-BB20-315150882***@microsoft.com> >>MIME-Version: 1.0 >>Content-Type: text/plain >>Content-Transfer-Encoding: 7bit >>From: stch***@online.microsoft.com (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: <e4ta4ie6HHA.4***@TK2MSFTNGHUB02.phx.gbl> >>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. >>> >>> >>> >>>"Steven Cheng[MSFT]" wrote: >>> >>>> 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:DeviceSpecific 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:DeviceSpecific> >>>> > >>>> >...... >>>> > >>>> >>>> >>> >> >> > > Hi Steven,
Thanks for your posts, this will be helpful if I need to get it working on other mobile devices later. I have managed to get it working on a standard html based ASP.NET page for now. However, I have now noticed that the the file name part of the file path seams to be restricted to a maximum of 10 chars. I have tried adding the maxLength at a custom attribute but this does not seam to have any effect. Any ideas how I might be able to allow the user to submit longer file names ? Woodgnome. P.S. This is on the Windows Mobile 6 Classic Emulator. Show quote "Steven Cheng[MSFT]" wrote: > Hi Woodgnome, > > Does the further info in my last reply helps? If there is anything else we > can help, please feel free to post here. > > Sincerely, > > Steven Cheng > > Microsoft MSDN Online Support Lead > > > This posting is provided "AS IS" with no warranties, and confers no rights. > > > -------------------- > >Date: Fri, 31 Aug 2007 04:02:44 GMT > >Subject: RE: FileUpload Control on Mobile Form > >>Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols > ing-Host: tomcatimport2.phx.gbl 10.201.218.182 > > > >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: <7A4749E1-C6CF-4E97-9433-91700D58D***@microsoft.com> > ><B5gE#lF6HHA.5***@TK2MSFTNGHUB02.phx.gbl> > ><FBD0A78F-C4A5-419C-BB20-315150882***@microsoft.com> > >>MIME-Version: 1.0 > >>Content-Type: text/plain > >>Content-Transfer-Encoding: 7bit > >>From: stch***@online.microsoft.com (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: <e4ta4ie6HHA.4***@TK2MSFTNGHUB02.phx.gbl> > >>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. > >>> > >>> > >>> > >>>"Steven Cheng[MSFT]" wrote: > >>> > >>>> 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:DeviceSpecific 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:DeviceSpecific> > >>>> > > >>>> >...... > >>>> > > >>>> > >>>> > >>> > >> > >> > > > > > > Thanks for your followup Woodgnome,
For the upload control, I haven't got any known of filename size limitation(at least not 10 chars). Does this problem only occur for your mobile devices? I've tested it on standard aspx page and PC boxes and I can submit long-filename files. Just use the below cose to printout the filename: >>>>>>>>>>>>>>>>> protected void Button1_Click(object sender, EventArgs e){ if (FileUpload1.HasFile) { Response.Write("<br/>filename: " + FileUpload1.FileName); } } >>>>>>>>>>>>>>>> Sincerely,Steven Cheng Microsoft MSDN Online Support Lead This posting is provided "AS IS" with no warranties, and confers no rights. -------------------- Show quote >Subject: RE: FileUpload Control on Mobile Form enctype="multipart/form-data".>Date: Thu, 13 Sep 2007 03:44:00 -0700 >Hi Steven, > >Thanks for your posts, this will be helpful if I need to get it working on >other mobile devices later. > >I have managed to get it working on a standard html based ASP.NET page for >now. > >However, I have now noticed that the the file name part of the file path >seams to be restricted to a maximum of 10 chars. I have tried adding the >maxLength at a custom attribute but this does not seam to have any effect. >Any ideas how I might be able to allow the user to submit longer file names ? > >Woodgnome. > >P.S. This is on the Windows Mobile 6 Classic Emulator. > >"Steven Cheng[MSFT]" wrote: > >> Hi Woodgnome, >> >> Does the further info in my last reply helps? If there is anything else we >> can help, please feel free to post here. >> >> Sincerely, >> >> Steven Cheng >> >> Microsoft MSDN Online Support Lead >> >> >> This posting is provided "AS IS" with no warranties, and confers no rights. >> >> >> -------------------- >> >Date: Fri, 31 Aug 2007 04:02:44 GMT >> >Subject: RE: FileUpload Control on Mobile Form >> >>Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols >> ing-Host: tomcatimport2.phx.gbl 10.201.218.182 >> > >> >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: >> > Html/Chtml/XhtmlMobileTextWriter >> >To inject this property you can inherit Show quote >> >class and override their WriteBeginTag method. The override method is http://www.developershome.com/wap/wapUpload/wap_upload.asp?page=intro>> >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: <7A4749E1-C6CF-4E97-9433-91700D58D***@microsoft.com> >> ><B5gE#lF6HHA.5***@TK2MSFTNGHUB02.phx.gbl> >> ><FBD0A78F-C4A5-419C-BB20-315150882***@microsoft.com> >> >>MIME-Version: 1.0 >> >>Content-Type: text/plain >> >>Content-Transfer-Encoding: 7bit >> >>From: stch***@online.microsoft.com (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: <e4ta4ie6HHA.4***@TK2MSFTNGHUB02.phx.gbl> >> >>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. >> >>> >> >>> >> >>> >> >>>"Steven Cheng[MSFT]" wrote: >> >>> >> >>>> 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, >> >>>> >> >>>> Show quote >> >>>> >> >>>> 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:DeviceSpecific 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:DeviceSpecific> >> >>>> > >> >>>> >...... >> >>>> > >> >>>> >> >>>> >> >>> >> >> >> >> >> > >> > >> >> > Steven,
Thanks for the reply. It's just on the Windows Mobile 6 Classic Emulator. It works OK in a normal browser. The fileupload.HasFile property is set to false on postback. I am guessing that maxLength attribute on the rendered <input> tag is defaulting to 10 on the mobile device, but setting on rendering doesnt seam to have any effect. Woodgnome. Show quote "Steven Cheng[MSFT]" wrote: > Thanks for your followup Woodgnome, > > For the upload control, I haven't got any known of filename size > limitation(at least not 10 chars). Does this problem only occur for your > mobile devices? I've tested it on standard aspx page and PC boxes and I can > submit long-filename files. Just use the below cose to printout the > filename: > > >>>>>>>>>>>>>>>>> > protected void Button1_Click(object sender, EventArgs e) > { > if (FileUpload1.HasFile) > { > Response.Write("<br/>filename: " + FileUpload1.FileName); > } > } > >>>>>>>>>>>>>>>> > > > Sincerely, > > Steven Cheng > > Microsoft MSDN Online Support Lead > > > This posting is provided "AS IS" with no warranties, and confers no rights. > > -------------------- > > >Subject: RE: FileUpload Control on Mobile Form > >Date: Thu, 13 Sep 2007 03:44:00 -0700 > > >Hi Steven, > > > >Thanks for your posts, this will be helpful if I need to get it working on > >other mobile devices later. > > > >I have managed to get it working on a standard html based ASP.NET page for > >now. > > > >However, I have now noticed that the the file name part of the file path > >seams to be restricted to a maximum of 10 chars. I have tried adding the > >maxLength at a custom attribute but this does not seam to have any effect. > >Any ideas how I might be able to allow the user to submit longer file > names ? > > > >Woodgnome. > > > >P.S. This is on the Windows Mobile 6 Classic Emulator. > > > >"Steven Cheng[MSFT]" wrote: > > > >> Hi Woodgnome, > >> > >> Does the further info in my last reply helps? If there is anything else > we > >> can help, please feel free to post here. > >> > >> Sincerely, > >> > >> Steven Cheng > >> > >> Microsoft MSDN Online Support Lead > >> > >> > >> This posting is provided "AS IS" with no warranties, and confers no > rights. > >> > >> > >> -------------------- > >> >Date: Fri, 31 Aug 2007 04:02:44 GMT > >> >Subject: RE: FileUpload Control on Mobile Form > >> >>Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols > >> ing-Host: tomcatimport2.phx.gbl 10.201.218.182 > >> > > >> >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: <7A4749E1-C6CF-4E97-9433-91700D58D***@microsoft.com> > >> ><B5gE#lF6HHA.5***@TK2MSFTNGHUB02.phx.gbl> > >> ><FBD0A78F-C4A5-419C-BB20-315150882***@microsoft.com> > >> >>MIME-Version: 1.0 > >> >>Content-Type: text/plain > >> >>Content-Transfer-Encoding: 7bit > >> >>From: stch***@online.microsoft.com (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: <e4ta4ie6HHA.4***@TK2MSFTNGHUB02.phx.gbl> > >> >>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. > >> >>> > >> >>> > >> >>> > >> >>>"Steven Cheng[MSFT]" wrote: > >> >>> > >> >>>> 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 Hi Woodgnome,
Since Steven is out of office for several days, I will continue work with you on this post. Let me first summarize the issue so far: you're now able to make the FileUpload work on mobile WebForm but the file name length is restricted to 10. Would you please send me a copy of your test web project along with detailed configuration (emulator, browser version) to me? I will try to reproduce the issue on my side and see if we could find the root cause. Thanks for the trouble. Regards, Walter Wang (waw***@online.microsoft.com, remove 'online.') Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. Hi Walter,
Thanks for the help. It's easy to reproduce just create a new web site, add a normal web page, add a file upload control and an asp link button and add the code suggested by Steven to the on click event of the link button. The emulator is the one include in the Windows Mobile 6 Professional SDK - Windows Mobile 6 Classic Emulator and the browser is the one included with the emulator. When the file name is greater than 10 chars no repsonse is returned because the fileuplad.HasFile property is set to false on postback. It works OK in IE on a normal desktop. I have included the code from the test site below : Thanks. Woodgnome. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" ValidateRequest="false"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:FileUpload ID="FileUpload1" runat="server" /> <br /> <br /> <asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">OK</asp:LinkButton> </div> </form> </body> </html> using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void LinkButton1_Click(object sender, EventArgs e) { if (FileUpload1.HasFile) { Response.Write("<br/>filename: " + FileUpload1.FileName); } } } ""Walter Wang [MSFT]"" wrote: Show quote > Hi Woodgnome, > > Since Steven is out of office for several days, I will continue work with > you on this post. > > Let me first summarize the issue so far: you're now able to make the > FileUpload work on mobile WebForm but the file name length is restricted to > 10. > > Would you please send me a copy of your test web project along with > detailed configuration (emulator, browser version) to me? I will try to > reproduce the issue on my side and see if we could find the root cause. > Thanks for the trouble. > > > Regards, > Walter Wang (waw***@online.microsoft.com, remove 'online.') > Microsoft Online Community Support > > ================================================== > When responding to posts, please "Reply to Group" via your newsreader so > that others may learn and benefit from your issue. > ================================================== > > This posting is provided "AS IS" with no warranties, and confers no rights. > > Hi Woodgnome,
So you're not using MobileWebForm? I thought we're discussing FileUpload on MobileWebForm. If you're using mobile device to access the normal WebForm, I think many functions are not supported and the result is unexpected. Though I haven't find any document described this 10 characters length limit of uploaded file name. Regards, Walter Wang (waw***@online.microsoft.com, remove 'online.') Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. |
|||||||||||||||||||||||