0

I just need the name of the file, but when I click the save button it kinda uploads the file (big files will produce an exception) and I don't want the page to "try" to upload the file.

Markup:

<asp:FileUpload runat="server" ID="txtPDFPath" />

Code Behind:

Reference r = new Reference() { R_CatalogNumber = txtCatalogNumber.Text.ToLower(), R_PDFPath = txtPDFPath.FileName.ToLower() };
Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179
Luiscencio
  • 3,855
  • 13
  • 43
  • 74
  • Related: [Browse for file window without uploading the file](http://stackoverflow.com/q/10322936/242) – Dhaust Nov 02 '12 at 06:21

1 Answers1

0

So the workaround I figured out was to use a simple 'input type="file"' and a asp textbox with 'Style=""display:none"' and with some javascript set the text of the textbox to the file input value, note that you will get c:\fakepath\filename so you can use the Path class to get just the file name... it wokrs perfectly...

Luiscencio
  • 3,855
  • 13
  • 43
  • 74