Use HTML <input type="file" > instead of .Net FileUpload control?

G

Gert

Would it be possible to access the file CONTENT in codebehind for a
standard:
<input id="htmlFile" type="file" />

Then in codebehind:
foreach (string keyName in
System.Web.HttpContext.Current.Request.Form.Keys)
{
//i can see keyName = "htmlFile" here as well as the "c:/myfile.txt"
for example
// i need content here
}

I cant use:
<asp:FileUpload ID="dotnetFile" runat="server" />
because I attempt to integrate legacy ASP application in our new
master page UI framework.

Help would be much appreciated

G
 
P

Patrice

ASP.NET controls are just a way to generate HTML markup anyway i..e. the
file upload control just creates an input type="file" tag. If you want to
get a file posted from a non ASP.NET page, it's likely the simplest way
would be to use the Request.Files collection...
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Gert said:
Would it be possible to access the file CONTENT in codebehind for a
standard:
<input id="htmlFile" type="file" />

Then in codebehind:
foreach (string keyName in
System.Web.HttpContext.Current.Request.Form.Keys)
{
//i can see keyName = "htmlFile" here as well as the "c:/myfile.txt"
for example
// i need content here
}

I cant use:
<asp:FileUpload ID="dotnetFile" runat="server" />
because I attempt to integrate legacy ASP application in our new
master page UI framework.

Use the Request.Files collection.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top