doubt abt asp .net HtmlInputFile ctrl
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngbeta' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Sampada Khare
-- This message, which was originally sent to "aspngcommunity", has been moved to "aspngbeta" mailing list by the List Master --

Scenario: I have HtmlInputFile ctrls File_1 to File_5
In the Button_Click method with Script language as VB and runat =server i
have to upload the files.
How do i loop thru the HtmlInputFile ctrls w/o having to write seperate
code for all the ctrls???

Is there any method like there was "eval" in javascript ??

Reply to this message...
 
    
Scott Watermasysk (VIP)
For i = 1 to 5
Request.Form("File_" & i)
...
Next

HTH.
Scott

-----Original Message-----
From: Sampada Khare [mailto:Click here to reveal e-mail address]
Sent: Monday, May 07, 2001 7:04 AM
To: aspngbeta
Subject: [aspngbeta] doubt abt asp .net HtmlInputFile ctrl

-- This message, which was originally sent to "aspngcommunity", has been
moved to "aspngbeta" mailing list by the List Master --

Scenario: I have HtmlInputFile ctrls File_1 to File_5
In the Button_Click method with Script language as VB and runat =server i
have to upload the files.
How do i loop thru the HtmlInputFile ctrls w/o having to write seperate
code for all the ctrls???

Is there any method like there was "eval" in javascript ??

| [aspngbeta] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngbeta.asp = JOIN/QUIT

Reply to this message...
 
    
Andy Smith (VIP)
The performance wouldnt' be the best... but...
All Controls have a FindControl method which takes a string as the id of =
the control.
So what you could do is a loop that generates a string of the control's =
id, and run a FindControl on the parent of them.

Andy Smith
Staff Programmer
Harding ESE

    -----Original Message-----
        From:    Click here to reveal e-mail address=20
Sent:    Monday, May 07, 2001 5:04 AM
To:    "aspngbeta" <Click here to reveal e-mail address>
Subject:    [aspngbeta] doubt abt asp .net HtmlInputFile ctrl
=09
-- This message, which was originally sent to "aspngcommunity", has been =
moved to "aspngbeta" mailing list by the List Master --

Scenario: I have HtmlInputFile ctrls File_1 to File_5
In the Button_Click method with Script language as VB and runat =3Dserver =
i
have to upload the files.
How do i loop thru the HtmlInputFile ctrls w/o having to write seperate
code for all the ctrls???

Is there any method like there was "eval" in javascript ??
=20

| [aspngbeta] member Click here to reveal e-mail address =3D YOUR ID
| http://www.asplists.com/asplists/aspngbeta.asp =3D JOIN/QUIT

Reply to this message...
 
    
Donny Mack
Short example:

Disclaimer I may be wrong with syntax because I couldn't test but you should
get the idea.

HttpFileCollection UploadedFiles = Request.Files;

for (int i = 0; i < UploadedFiles.Count; i++) {
UploadedFiles[i].SaveAs(Server.MapPath("Images") +
System.IO.Path.GetFileName(UploadedFiles[i].FileName)
}

Hope this helps

Don R. Mack, MCSD
CodeJunkies.NET
________________________________________________
Are you a DotNetJunkie?
http://www.AspNextGen.com | http://www.DotNetJunkies.com

Still not enough – Buy the book:
Programming Datadriven Web Applications with ASP.NET
by Don Mack, Doug Seven
http://www.amazon.com/exec/obidos/ASIN/0672321068/dotnetjunkies-20/107-16847" target="_blank">http://www.amazon.com/exec/obidos/ASIN/0672321068/dotnetjunkies-20/107-16847
06-9934918
<http://www.amazon.com/exec/obidos/ASIN/0672321068/dotnetjunkies-20/107-1684
706-9934918>
“You the man!”
- Me looking in the mirror!

-----Original Message-----
From: Sampada Khare [mailto:Click here to reveal e-mail address]
Sent: Monday, May 07, 2001 4:04 AM
To: aspngbeta
Subject: [aspngbeta] doubt abt asp .net HtmlInputFile ctrl

-- This message, which was originally sent to "aspngcommunity", has been
moved to "aspngbeta" mailing list by the List Master --

Scenario: I have HtmlInputFile ctrls File_1 to File_5
In the Button_Click method with Script language as VB and runat =server i
have to upload the files.
How do i loop thru the HtmlInputFile ctrls w/o having to write seperate
code for all the ctrls???

Is there any method like there was "eval" in javascript ??

| [aspngbeta] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngbeta.asp = JOIN/QUIT

Reply to this message...
 
 
System.IO.Path
System.Web.HttpFileCollection
System.Web.UI.HtmlControls.HtmlInputFile




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com