fileupload postback
-
im using fileupload to upload images.. written code in button click.. once i click the button image is displayong but the path is disappearing on its postback i want the path of image uploaded even after image is displayed... thanks
/to display image
//button click
string virtualFolder = "~/Uploads1/";
string physicalFolder = Server.MapPath(virtualFolder);
FileUpload1.SaveAs(physicalFolder + FileUpload1.FileName);
Image1.Visible = true;
Image1.ImageUrl = virtualFolder + FileUpload1.FileName; -
im using fileupload to upload images.. written code in button click.. once i click the button image is displayong but the path is disappearing on its postback i want the path of image uploaded even after image is displayed... thanks
/to display image
//button click
string virtualFolder = "~/Uploads1/";
string physicalFolder = Server.MapPath(virtualFolder);
FileUpload1.SaveAs(physicalFolder + FileUpload1.FileName);
Image1.Visible = true;
Image1.ImageUrl = virtualFolder + FileUpload1.FileName;--Try this-- String virtualFolder = Server.MapPath(@"Uploads1\\"); if (FileUpload1.HasFile) { String fileName = FileUpload1.FileName; virtualFolder += fileName; FileUpload1.SaveAs(virtualFolder); } else { //error statement }
Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]
-
--Try this-- String virtualFolder = Server.MapPath(@"Uploads1\\"); if (FileUpload1.HasFile) { String fileName = FileUpload1.FileName; virtualFolder += fileName; FileUpload1.SaveAs(virtualFolder); } else { //error statement }
Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]
-
im using fileupload to upload images.. written code in button click.. once i click the button image is displayong but the path is disappearing on its postback i want the path of image uploaded even after image is displayed... thanks
/to display image
//button click
string virtualFolder = "~/Uploads1/";
string physicalFolder = Server.MapPath(virtualFolder);
FileUpload1.SaveAs(physicalFolder + FileUpload1.FileName);
Image1.Visible = true;
Image1.ImageUrl = virtualFolder + FileUpload1.FileName;I think we can not display the name of the file which is uploaded because property fileupload.filename is readonly and it can be set only if user browse the image
-
I think we can not display the name of the file which is uploaded because property fileupload.filename is readonly and it can be set only if user browse the image