locked
How to upload image in Mobile Application? RRS feed

  • Question

  • User-430272468 posted

    I have requirement to upload the image in mobile Web application using asp.net. For this I have add mobile templates but regarding to image there is no any file upload control. Then I see one article and use the below code:

    <mobile:DeviceSpecific ID="DeviceSpecific1" Runat="server">
            <Choice>
                <ContentTemplate>            
                    <input style="width: 389px; height: 22px" type="file" size="45" runat="server" id="FileUpload1">
                    <mobile:Command ID="Command3" Runat="server" OnClick="C3">Upload Image</mobile:Command>
                </ContentTemplate>
            </Choice>
            </mobile:DeviceSpecific>   

    <mobile:DeviceSpecific ID="DeviceSpecific1" Runat="server">

            <Choice>

                <ContentTemplate>            

                    <input style="width: 389px; height: 22px" type="file" size="45" runat="server" id="FileUpload1">

                    <mobile:Command ID="Command3" Runat="server" OnClick="C3">Upload Image</mobile:Command>

                </ContentTemplate>

            </Choice>

            </mobile:DeviceSpecific>   


    <script runat="server">

        protected void C2(object sender, EventArgs e)

        {

            HttpFileCollection uploadFll = Request.Files;

            for (Int16 i = 0; i < uploadFll.Count; i++)

            {

                HttpPostedFile pf = (HttpPostedFile)uploadFll[i];

                String fileExt = Path.GetExtension(pf.FileName).ToLower();

                String fileName = Path.GetFileName(pf.FileName);

                pf.SaveAs(Server.MapPath(".") + fileName);

            }

            Response.Write("Image Uploaded");

        }

    </script>

    but still its not working. 


    Please help me..................

    Thursday, August 12, 2010 3:02 AM

Answers

All replies