Asp.net fileupload control postback problems
Posted
by Spooky2010
on Stack Overflow
See other posts from Stack Overflow
or by Spooky2010
Published on 2010-05-31T03:19:45Z
Indexed on
2010/05/31
3:22 UTC
Read the original article
Hit count: 560
using ASP.net, vs2008 C#.
Im using a FileUpload control on a webform. The uploading of a file (ie PDF dcouments) to a server directory works ok.
I have on the webform a "preview" button that the user can use to preview the PDF file after they have selected it via the Fileupload browse feature. I do this by
if (this.FileUpload1.HasFile) { localURL = FileUpload1.PostedFile.FileName; // use this to preview file. Other methods are restricted by local security requirements Process.Start(localURL); }
My problems is that after the button click Postback occurs the location of the selected file disappears from the textbox part of the Fileupload control.
How can i keep this info there, so the user does not have to browse again and instead can just click upload to upload the file.
Any help appreciated
thanks
© Stack Overflow or respective owner