4
Answers

error

Navaz

Navaz

11y
1.3k
1
j qury-------------

<script src="js/jquery-1[1][1].8.0.js" type="text/javascript">

        function detectfile() {
            var btn = document.getElementById('< %=btnHidden.ClientID % >');
            if (btn) {
                btn.click();
            }

        }






file upload


 <asp:FileUpload ID="FileUpload1" runat="server" on change="datafile()" />

 <asp:Button runat="server" Text="Button"   OnClick="Unnamed1_Click" style="display:none"
                ID="btnHidden" />

button click



            if (FileUpload1.HasFile)
            {
                string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
                string strExtension = Path.GetExtension(FileUpload1.FileName).ToLower();
                if (strExtension == ".jpg" || strExtension == ".jpeg")
                {
                    string photoName = "IMG" + DateTime.Now.Ticks + fileName;
                    FileUpload1.SaveAs(Server.MapPath("~\\images\\Temp\\" + photoName));
                    ViewState["photo"] = photoName;
                    Image2.ImageUrl = "~\\images\\Temp\\" + photoName;

                }
but image is not visible in the image control




Answers (4)