Passing multipart/form data

Discussion in 'ASP General' started by Jason, Jan 21, 2004.

  1. Jason

    Jason Guest

    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
     
    Jason, Jan 21, 2004
    #1
    1. Advertising

  2. Jason

    Don Verhagen Guest

    "Jason" <> wrote in message
    news:...
    > 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
     
    Don Verhagen, Jan 21, 2004
    #2
    1. Advertising

  3. Jason

    Steven C Guest

    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
    >.
    >
     
    Steven C, Jan 21, 2004
    #3
  4. Jason

    OpticTygre Guest

    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" <> wrote in message
    news:14ba01c3e032$49a4a760$...
    > ASPUpload will tell you how many files were uploaded with
    > the form... www.persits.com
    >
    >
     
    OpticTygre, Jan 22, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Li Zhang
    Replies:
    4
    Views:
    6,145
    softip
    Feb 27, 2009
  2. Matt
    Replies:
    8
    Views:
    144,673
    zeeshanakhter2009
    May 26, 2012
  3. Steven K
    Replies:
    3
    Views:
    1,049
    Chris Baldwin
    Mar 1, 2004
  4. Kevin DeValck
    Replies:
    1
    Views:
    783
    7stud --
    May 17, 2011
  5. Replies:
    1
    Views:
    466
Loading...

Share This Page