File Dialog to choose a path and file

  • Thread starter Thread starter B Garrett
  • Start date Start date
B

B Garrett

Hi,

I have a .ASPX page using C# and I need to read in a text file from a
selected path. so in need the file dialog box to allow the user to choose
the path and file that they want to read in.

What command can I use todo this in a .ASPX page, I tried getting it to use
windows that has the file dialog box but cannot get system.window class to
be included in the project.

Thanks,
B Garrett
 
B Garrett,

You can not use System.Windows.Forms in an ASP.NET application because
your code is running on the server side, not the client.

What you want to do is use an input element of type file, I believe (the
html is something like <input type="file">) and it will allow you add a file
browse to the page on the client side, which will then allow a file to be
posted back to the page. The type in ASP.NET that you want to use is the
HtmlInputFile control.

Hope this helps.
 
What you want to do is use an input element of type file, I believe
(the html is something like <input type="file">) and it will allow you add
a file browse to the page on the client side, which will then allow a file
to be posted back to the page. The type in ASP.NET that you want to use
is the HtmlInputFile control.

To expand on what Nickolas has pointed out..:

IN MSDN Library:

ms-help://MS.MSDNQTR.2003FEB.1033/Cpqstart/html/cpsmpnetsamples-aspnetservercontrolreference.htm#cpsmpHtmlInputFile1Sample

Web Link:

http://msdn.microsoft.com/library/e...ence.asp?frame=true#cpsmphtmlinputfile1sample

Click on the HtmlInputFile1 Sample link.

HTH :)

Mythran
 
Back
Top