views:

312

answers:

2

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

A: 

This may be a duplicate. See this question: http://stackoverflow.com/questions/968251/retain-value-in-fileupload-control

James Lawruk
A: 

try putting the localURL variable into a session. worked for me once

SalemFayad