Passing multipart/form data

J

Jason

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
 
D

Don Verhagen

Jason said:
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
 
O

OpticTygre

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top