473,326 Members | 2,815 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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

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
3 10363
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bhavin | last post by:
Hi I'm trying to set default value for input type file. <input type="File" name="tx_pdffile" accept="*.pdf" class="boxText" value="abc.pdf"> but this value (abc.pdf) doesnt appear in the text...
2
by: @lias | last post by:
Hi all I have a webpage where I want the user to input filenames. To make this easier, I use a file input type so that the user can select files rather than typing in the filename, using the...
2
by: Matt | last post by:
If I do the following, the browse text box still cannot see C:/hello world/test.txt. <input type="file" name="fileName" value="C:/hello world/test.txt" size=80> Any ideas? and workarounds...
2
by: Laermans_k | last post by:
Hi, Does anyone have a solution to use the <input type="file" id="filechooser"> and the <input type="submit" id="submitbutton"> in 1 button click? I've already tried to create a javascript...
1
by: Mark Sandfox | last post by:
Is there a way to restrict the user to only selecting and sending either a ..gif or .jpg. Everything I have read says this option can not be done by design (security reasons). I find that irronic...
7
by: Drew Berkemeyer | last post by:
I've encounted a pretty strange problem and I'm not quite sure what to make of it. I have a web service that consumes an XML file as well as a few other parameters. This web service works fine...
17
by: Alan Silver | last post by:
Hello, I have a page which I am converting to use themes. The page has an HTML <input type="image"> element that is used to post to another page. I would like to replace this with a server...
2
by: Tarkeshwar | last post by:
Hi All, I want to restrict the user from being entering the value in <input type="file">. It works fine in IE but not in Mozilla. I am sending my code also which works in IE and not in Mozilla.Can...
1
by: ChollaPete | last post by:
This code: <form action="processScan.php" method="get"> <p> <?php print "Scan name: <input type=\"file\" name=\"tScanFileName\" value= \"{$scanFileName}\"><br>"; addHiddenCarryons(); ?>...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.