Search code examples
c#asp.netwebformsopenfiledialog

OpenFileDialog in ASP.NET


How can I run sth like OpenFileDialog? In ASP.NET there's no this control.

Yes, there's option to use

<input type="file" name="filediag" />

but there's default name disabled to modifications.

I found either solution

<input type="file" name="filediag" style="display:none" />
<input type="button" value="browse..." onclick="document.form1.filediag.click()" />

but it doesn't work...or I'm doing sth wrong.

Is there other possibility to do this?


Solution

  • You must have missed the FileUpload control - this is the equivalent to the HTML input type="file" used for uploading files.

    It exposes the uploaded file - name and contents.