开发者

Asp.net fileupload control postback problems

开发者 https://www.devze.com 2023-01-01 20:35 出处:网络
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.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消