By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,201 Members | 1,617 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,201 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

Jul 10 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi,

you could try iterating Request.Files (item type is HttpPostedFile)

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net
"Gert" <ge***********@gmail.comwrote in message
news:11**********************@n60g2000hse.googlegr oups.com...
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

Jul 10 '07 #2

P: n/a
Gert wrote:
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.

--
Göran Andersson
_____
http://www.guffa.com
Jul 10 '07 #3

P: n/a
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...

--
Patrice

"Gert" <ge***********@gmail.coma écrit dans le message de news:
11**********************@n60g2000hse.googlegroups. com...
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

Jul 10 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.