File uploading mixed with form input

Discussion in 'ASP General' started by furby, Jul 11, 2006.

  1. furby

    furby Guest

    I've been browsing around the web for an answer to this and I can't
    find a good answer to it.... here's the problem:

    I am using an ASP include file called "ClsUpload.asp" to upload a text
    file for processing. I also have a select drop down that i am
    submitting along with the file, in order to determine where in the
    database this info goes. My problem is that I can upload the file
    without any problems, but I can't get at the select field at all. I
    first tried using the normal "Request("Listid")" function, but that
    didn't work (At first I was using it after the file upload and it gave
    me an error message. Then I moved it to before the upload and it
    doesn't give me an error anymore, but also doesn't seem to see
    anything).

    Then I tried request.form("listid"), which some of the discussions on
    the web point to. The code still sees nothing at all being submitted. I
    tried it both before and after the file upload....

    I don't see any info on doing something like this within the
    clsupload.asp file, so I'm thinking that the problem is stemming from
    my use of the enctype="multipart/form-data" tag.

    How can I do this? I suppose that if worst comes to worst, i can just
    break the form up accross two pages and use it like that, but that
    seems kind of ugly. Is there a simple way around this?
    furby, Jul 11, 2006
    #1
    1. Advertising

  2. furby

    Tim Slattery Guest

    "furby" <> wrote:

    >I've been browsing around the web for an answer to this and I can't
    >find a good answer to it.... here's the problem:
    >
    >I am using an ASP include file called "ClsUpload.asp" to upload a text
    >file for processing. I also have a select drop down that i am
    >submitting along with the file, in order to determine where in the
    >database this info goes. My problem is that I can upload the file
    >without any problems, but I can't get at the select field at all. I
    >first tried using the normal "Request("Listid")" function, but that
    >didn't work (At first I was using it after the file upload and it gave
    >me an error message. Then I moved it to before the upload and it
    >doesn't give me an error anymore, but also doesn't seem to see
    >anything).
    >
    >Then I tried request.form("listid"), which some of the discussions on
    >the web point to. The code still sees nothing at all being submitted. I
    >tried it both before and after the file upload....
    >
    >I don't see any info on doing something like this within the
    >clsupload.asp file, so I'm thinking that the problem is stemming from
    >my use of the enctype="multipart/form-data" tag.


    Basically, yes. The 'enctype="multipart/form-data"' tag causes the
    contents of the form - including any files specified by <input
    type="file"....> tags as well as more normal tags - to be transmitted
    in MIME format. All the data is there, and if the component you're
    using to untangle the MIME blob isn't giving you the contents of the
    "normal" tags, then it's not doing its job. I'm sure you can find
    something that will work properly.

    --
    Tim Slattery
    MS MVP(DTS)
    Tim Slattery, Jul 11, 2006
    #2
    1. Advertising

  3. furby

    furby Guest

    Freeaspupload.asp works like a charm - thanks. Now, for the next
    question and it relates directly to that particular class.

    How do I retrieve the name of the uploaded file? I see a second class
    named "UploadedFile" but there is no documentation for it. The
    documentation refers to the filename property of the main object, but
    that doesn't work...

    Justin Piper wrote:
    > On Tue, 11 Jul 2006 09:03:48 -0500, furby <> wrote:
    > > I am using an ASP include file called "ClsUpload.asp" to upload a text
    > > file for processing. I also have a select drop down that i am
    > > submitting along with the file, in order to determine where in the
    > > database this info goes. My problem is that I can upload the file
    > > without any problems, but I can't get at the select field at all.

    >
    > These classes (and also their COM counterparts) work by manually
    > processing the form data submitted by the browser, which renders the
    > Request.Form collection inoperable. Normally they expose their own Form
    > collection so that this data is still available. If your upload utility
    > doesn't have such functionality, you might consider using the one from
    > http://www.freeaspupload.net/ instead.
    >
    > --
    > Justin Piper
    > Bizco Technologies
    > http://www.bizco.com/
    furby, Jul 11, 2006
    #3
  4. furby

    furby Guest

    Excellent! Thank you very much - works like a chamr!

    Justin Piper wrote:
    > On Tue, 11 Jul 2006 15:14:16 -0500, furby <> wrote:
    > > Freeaspupload.asp works like a charm - thanks. Now, for the next
    > > question and it relates directly to that particular class.
    > >
    > > How do I retrieve the name of the uploaded file? I see a second class
    > > named "UploadedFile" but there is no documentation for it. The
    > > documentation refers to the filename property of the main object, but
    > > that doesn't work...

    >
    > There's an UploadedFiles property that exposes a Scripting.Dictionary
    > object with information about all the files uploaded. Something like
    > this should do the trick:
    >
    > Dim upload, file
    > Set upload = New FreeASPUpload
    > For Each file In upload.UploadedFiles.Items()
    > Response.Write file.FileName & "<br>" ' or whatever you like
    > Next
    >
    > --
    > Justin Piper
    > Bizco Technologies
    > http://www.bizco.com/
    furby, Jul 12, 2006
    #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. Andy Johns
    Replies:
    2
    Views:
    385
    Alvin Bruney [MVP]
    Mar 2, 2004
  2. John Scalco
    Replies:
    1
    Views:
    404
    Steve C. Orr [MVP, MCSD]
    Jun 9, 2004
  3. tshad
    Replies:
    6
    Views:
    617
    tshad
    Sep 30, 2005
  4. Dung Ping
    Replies:
    10
    Views:
    946
    Chaddy2222
    Jan 16, 2006
  5. Ron Brennan
    Replies:
    5
    Views:
    304
    Dr John Stockton
    May 14, 2004
Loading...

Share This Page