FileUpload in PDA(IE Mobile Ver. 5)

Discussion in 'ASP .Net' started by T.Jeywin Lizy, Dec 9, 2008.

  1. I am unable to upload a file in PDA(IE Mobile Ver. 5) with FileUpload control.
    Please help me with the work around to acheive this task.

    I read in this community as given below. If this can be used please let me
    know how I should use this class given below with FileUpload control to serve
    my purpose.

    Info from your Community is as given below:
    --------------------------------------------------
    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");
    }
    }
    }
     
    T.Jeywin Lizy, Dec 9, 2008
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.