Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Passing multipart/form data

Reply
Thread Tools

Passing multipart/form data

 
 
Jason
Guest
Posts: n/a
 
      01-21-2004
Hi folks,

I'm trying to create a section of a website with a unique file upload
utility. The problem is that in most code and components I find to
pass multipart/form data, you need to know the number of files
specified to upload. I'm trying to solve this by having one INPUT
TYPE=FILE box, and, using javascript, each time someone selects a
file, it populates one listbox below it.

Once the submit button is pressed, I'm sending the form elements to
another pages that dynamically generates as many INPUT TYPE=FILE boxes
as necessary, submits the form, then tries to pass that data via the
enctype=multipart/form data FORM tag to another ASP page to handle the
data transfers. The code for the second page is as follows:


<BODY>
<FORM NAME=FormUploadFiles METHOD=POST ENCTYPE="multipart/form-data"
ID=FormUploadFiles ACTION=Upload3.asp>
<%
Dim TempVal, i
TempVal = Split(Request.Form("fnames"), " ")
For i = 1 to Ubound(TempVal)
Response.Write "<INPUT TYPE=FILE NAME=FILE" & i & " VALUE=" &
Chr(34) & TempVal(i) & chr(34) & "><BR>"
Next

Response.Write "<INPUT TYPE=HIDDEN NAME=TotalFiles VALUE=" &
Ubound(TempVal) & ">"
%>
<script type="text/javascript"><!--
document.forms[0].submit();
// --></script>

</FORM>

The code above creates the file elements, and submits the form
automatically, but for some reason, it isn't passing the raw data onto
the next ASP page. Does anyone know why this is, or have any better
suggestions for doing this? I'd rather not use a third party
component if I don't have to.

Thanks
-J
 
Reply With Quote
 
 
 
 
Don Verhagen
Guest
Posts: n/a
 
      01-21-2004

"Jason" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Hi folks,
>
> I'm trying to create a section of a website with a unique file upload
> utility. The problem is that in most code and components I find to
> pass multipart/form data, you need to know the number of files
> specified to upload. I'm trying to solve this by having one INPUT
> TYPE=FILE box, and, using javascript, each time someone selects a
> file, it populates one listbox below it.
>
> Once the submit button is pressed, I'm sending the form elements to
> another pages that dynamically generates as many INPUT TYPE=FILE boxes
> as necessary, submits the form, then tries to pass that data via the
> enctype=multipart/form data FORM tag to another ASP page to handle the
> data transfers. The code for the second page is as follows:
>
>
> <BODY>
> <FORM NAME=FormUploadFiles METHOD=POST ENCTYPE="multipart/form-data"
> ID=FormUploadFiles ACTION=Upload3.asp>
> <%
> Dim TempVal, i
> TempVal = Split(Request.Form("fnames"), " ")
> For i = 1 to Ubound(TempVal)
> Response.Write "<INPUT TYPE=FILE NAME=FILE" & i & " VALUE=" &
> Chr(34) & TempVal(i) & chr(34) & "><BR>"
> Next


You cannot specify a value for a INPUT VALUE="". It's a security feature,
thank god. Imagine if you could upload ANY file from MY computer without me
specifying it. I know in this case you are forming the list of user selected
files, but you can't.

Don Verhagen


 
Reply With Quote
 
 
 
 
Steven C
Guest
Posts: n/a
 
      01-21-2004
ASPUpload will tell you how many files were uploaded with
the form... www.persits.com


>-----Original Message-----
>Hi folks,
>
>I'm trying to create a section of a website with a unique

file upload
>utility. The problem is that in most code and components

I find to
>pass multipart/form data, you need to know the number of

files
>specified to upload. I'm trying to solve this by having

one INPUT
>TYPE=FILE box, and, using javascript, each time someone

selects a
>file, it populates one listbox below it.
>
>Once the submit button is pressed, I'm sending the form

elements to
>another pages that dynamically generates as many INPUT

TYPE=FILE boxes
>as necessary, submits the form, then tries to pass that

data via the
>enctype=multipart/form data FORM tag to another ASP page

to handle the
>data transfers. The code for the second page is as

follows:
>
>
><BODY>
><FORM NAME=FormUploadFiles METHOD=POST

ENCTYPE="multipart/form-data"
>ID=FormUploadFiles ACTION=Upload3.asp>
><%
> Dim TempVal, i
> TempVal = Split(Request.Form("fnames"), " ")
> For i = 1 to Ubound(TempVal)
> Response.Write "<INPUT TYPE=FILE

NAME=FILE" & i & " VALUE=" &
>Chr(34) & TempVal(i) & chr(34) & "><BR>"
> Next
>
> Response.Write "<INPUT TYPE=HIDDEN NAME=TotalFiles

VALUE=" &
>Ubound(TempVal) & ">"
>%>
><script type="text/javascript"><!--
>document.forms[0].submit();
>// --></script>
>
></FORM>
>
>The code above creates the file elements, and submits the

form
>automatically, but for some reason, it isn't passing the

raw data onto
>the next ASP page. Does anyone know why this is, or have

any better
>suggestions for doing this? I'd rather not use a third

party
>component if I don't have to.
>
>Thanks
>-J
>.
>

 
Reply With Quote
 
OpticTygre
Guest
Posts: n/a
 
      01-22-2004
The problem with ASPUpload, and a lot of the other components designed for
this is that you need to have a specified number of Input boxes. My users
could upload anywhere between one and six hundred files. Hence the problem.


"Steven C" <(E-Mail Removed)> wrote in message
news:14ba01c3e032$49a4a760$(E-Mail Removed)...
> ASPUpload will tell you how many files were uploaded with
> the form... www.persits.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
Passing an array from FORTRAN to C then passing it within C andReturning it to FORTRAN deadpickle C Programming 1 11-07-2010 02:38 PM
Passing parameters to an executable vs. passing them to a server Ramon F Herrera C++ 8 09-13-2009 02:48 AM
passing copy of a pointer to a variable vs passing the copy pereges C Programming 7 06-01-2008 02:36 PM
Passing by const & and returning a temp vs passing by value and returningit Victor Bazarov C++ 25 03-23-2005 04:24 PM
Passing large data between forms, different apps terry ASP .Net 1 07-07-2003 06:05 PM



Advertisments