Asp.net fileupload control postback problems
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.HasF开发者_高级运维ile)
{
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
try putting the localURL variable into a session. worked for me once
精彩评论