Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Use HTML <input type="file" > instead of .Net FileUpload control?

Reply
Thread Tools

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

 
 
Gert
Guest
Posts: n/a
 
      07-10-2007
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

 
Reply With Quote
 
 
 
 
Patrice
Guest
Posts: n/a
 
      07-10-2007
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" <(E-Mail Removed)> a écrit dans le message de news:
(E-Mail Removed). 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
>



 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      07-10-2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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
>



 
Reply With Quote
 
=?ISO-8859-1?Q?G=F6ran_Andersson?=
Guest
Posts: n/a
 
      07-10-2007
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it any point to use html directly instead of label Tony Johansson ASP .Net 1 11-30-2010 09:54 AM
HTML Form inside ASP.NET form and fileupload admlangford@gmail.com ASP .Net 2 05-18-2008 07:42 AM
Why use asp controls instead of HTML inputs? =?Utf-8?B?U2hhd24gUmFtaXJleg==?= ASP .Net 8 05-23-2007 11:32 AM
How to tell VS to wite HTML element's styles in the CSS file automaticly instead of in the body of the HTML file. oranmeir@gmail.com ASP .Net 1 06-09-2006 06:53 AM
Fileupload problem with files larger than 1MB grimBeast ASP .Net 2 08-27-2003 09:03 PM



Advertisments