Loading ...
Sorry, an error occurred while loading the content.

Re: Uploading files

Expand Messages
  • Quentin Smith
    ... Hi- The CGI module is used to parse the POSTed data and separate the upload from the rest of the form data. I believe it creates a file in /tmp/ or
    Message 1 of 11 , Jul 11, 2002
    • 0 Attachment
      On Thursday, July 11, 2002, at 01:30 PM, timj_moore wrote:

      > Hi,
      >
      > I'm having trouble getting file uploads to work. Part of the problem
      > is I don't understand where CGI fits in. The documentation is saying
      > the uploads are done with CGI, but I've looked at the CGI file upload
      > documentation but to me it looks like the actual upload bit doesn't
      > require CGI. Same goes for the file upload sample. CGI seems to be
      > used to create the upload form but after that the upload is just
      > using perl's builtin 'read' function.
      Hi-
      The CGI module is used to parse the POSTed data and separate the upload
      from the rest of the form data. I believe it creates a file in /tmp/ or
      C:\WINDOWS\TEMP\, which is then read with read.
      >
      > Or have I got the wrong end of the stick?
      >
      > Anyway, what I've got is an ASP page that has a regular form that
      > posts the upload form data to another page (the upload field is
      > called 'uploadedfile'). The 2nd page accepts the upload form data
      > correctly but when 'read' is called I get nothing in my scalar
      > (though the 'read' loop correctly loops until the file has been read).
      >
      > My code is as follows...
      > ----
      > my $length = $Request->{TotalBytes};
      > print "TotalBytes = " . $length . "<br>";
      >
      > my $fileup = $Request->{FileUpload}{uploadedfile};
      > my $filehandle = $fileup->{FileHandle};
      > my $PostedData = "FFF";
      > print "PostedData = " . $PostedData . "<br>";
      > print "Length = " . length($PostedData) . "<br>";
      > while (read($filehandle, $PostedData, 1024))
      > {
      > print "a";
      > # data from the uploaded file read into $PostedData
      > }
      >
      > my $ContentType = $fileup->{ContentType};
      > print "ContentType = " . $ContentType . "<br>";
      >
      > print "PostedData = " . $PostedData . "<br>";
      > print "Length = " . length($PostedData) . "<br>";
      > ----
      >
      > What I get as a result is something like this...
      >
      > TotalBytes = 46840
      > PostedData = FFF
      > Length = 3
      > aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
      > ContentType = application/pdf
      > PostedData =
      > Length = 0
      >
      > The FFF and the a's are just so I can test that PostedData is being
      > changed and that the read is looping correctly and reading the right
      > ammount of data. The incoming file data is the right size and the
      > file is correctly being determined as a PDF.
      >
      > Yet PostedData ends up empty. ??
      >
      > Or am I missing something else and the scalar is being filled but you
      > just can't display the contents with a print (though PDF's are mostly
      > printable)? I'm not too hot on Perl so scalars confuse me a little.
      I believe was is happening is this:
      Each time you call read(), it fetches up to 1024 bytes (1kb, as you
      set). Since each time read is called, it erases $PostedData and then
      writes up to 1024 bytes into it, you can only end up with the last 1024
      bytes. HOWEVER, the last time read is called, it reaches EOF, so the
      last thing $PostedData is set to is undef. Here is a modified version of
      the code that I think will work (untested):

      my $length = $Request->{TotalBytes};
      print "TotalBytes = " . $length . "<br>";

      my $fileup = $Request->{FileUpload}{uploadedfile};
      my $filehandle = $fileup->{FileHandle};
      my $PostedData = "";
      print "PostedData = " . $PostedData . "<br>";
      print "Length = " . length($PostedData) . "<br>";
      my $in_buffer;
      while (read($filehandle, $in_buffer, 1024))
      {
      print "a";
      $PostedData .= $in_buffer; # Equivalent to $PostedData =
      $PostedData . $in_buffer, except .= is shorter and faster.
      # data from the uploaded file read into $PostedData
      }

      my $ContentType = $fileup->{ContentType};
      print "ContentType = " . $ContentType . "<br>";

      print "PostedData = " . $PostedData . "<br>";
      print "Length = " . length($PostedData) . "<br>";
      # As always, watch for line breaks.

      __END__

      HTH,
      --Quentin

      >
      > Ultimately the PostedData goes via SWIG into a C++ app, but that's
      > another matter, I just need it to get filled first.
      >
      > P.S. I don't called 'use CGI;' or anything, though I have tried
      > without success.
      >
      >
      >
      > Tim.


      ---------------------------------------------------------------------
      To unsubscribe, e-mail: asp-unsubscribe@...
      For additional commands, e-mail: asp-help@...
    • Tim Moore
      ... Fantastic. That was the problem! I love it when the fix is so simple. It looks like I don t need CGI in the end but then I guess it s because my form is
      Message 2 of 11 , Jul 12, 2002
      • 0 Attachment
        > -----Original Message-----
        > From: Quentin Smith [mailto:quentins@...]
        > Sent: 11 July 2002 20:07
        > To: Tim Moore
        > Cc: asp@...
        > Subject: Re: Uploading files
        >
        >
        >
        > I believe was is happening is this:
        > Each time you call read(), it fetches up to 1024 bytes (1kb, as you
        > set). Since each time read is called, it erases $PostedData and then
        > writes up to 1024 bytes into it, you can only end up with the
        > last 1024
        > bytes. HOWEVER, the last time read is called, it reaches EOF, so the
        > last thing $PostedData is set to is undef. Here is a modified
        > version of
        > the code that I think will work (untested):
        >
        > my $length = $Request->{TotalBytes};
        > print "TotalBytes = " . $length . "<br>";
        >
        > my $fileup = $Request->{FileUpload}{uploadedfile};
        > my $filehandle = $fileup->{FileHandle};
        > my $PostedData = "";
        > print "PostedData = " . $PostedData . "<br>";
        > print "Length = " . length($PostedData) . "<br>";
        > my $in_buffer;
        > while (read($filehandle, $in_buffer, 1024))
        > {
        > print "a";
        > $PostedData .= $in_buffer; # Equivalent to
        > $PostedData =
        > $PostedData . $in_buffer, except .= is shorter and faster.
        > # data from the uploaded file read into $PostedData
        > }
        >
        > my $ContentType = $fileup->{ContentType};
        > print "ContentType = " . $ContentType . "<br>";
        >
        > print "PostedData = " . $PostedData . "<br>";
        > print "Length = " . length($PostedData) . "<br>";
        > # As always, watch for line breaks.
        >
        > __END__
        >
        > HTH,
        > --Quentin

        Fantastic. That was the problem!

        I love it when the fix is so simple. It looks like I don't need CGI in the
        end but then I guess it's because my form is only posting the file so
        there's nothing to seperate? Seems to work anyway I can upload a PDF and
        return it and just tested it with BinaryWrite also and the PDF opens in
        Acrobat Reader! Cool.

        Many thanks :-)


        Tim.

        ---------------------------------------------------------------------
        To unsubscribe, e-mail: asp-unsubscribe@...
        For additional commands, e-mail: asp-help@...
      • Tim Moore
        ... Ah, I spoke to soon. It turns out the code that processes the data is expecting the full MIME multipart/form stuff (this is a port from an IIS app. It
        Message 3 of 11 , Jul 12, 2002
        • 0 Attachment
          > -----Original Message-----
          > From: Tim Moore
          > Sent: 12 July 2002 11:15
          > To: 'Quentin Smith'
          > Cc: asp@...
          > Subject: RE: Uploading files
          >
          >
          > > -----Original Message-----
          > > From: Quentin Smith [mailto:quentins@...]
          > > Sent: 11 July 2002 20:07
          > > To: Tim Moore
          > > Cc: asp@...
          > > Subject: Re: Uploading files
          > >
          > >
          > >
          > > I believe was is happening is this:
          > > Each time you call read(), it fetches up to 1024 bytes (1kb, as you
          > > set). Since each time read is called, it erases $PostedData
          > and then
          > > writes up to 1024 bytes into it, you can only end up with the
          > > last 1024
          > > bytes. HOWEVER, the last time read is called, it reaches
          > EOF, so the
          > > last thing $PostedData is set to is undef. Here is a modified
          > > version of
          > > the code that I think will work (untested):
          > >
          > > my $length = $Request->{TotalBytes};
          > > print "TotalBytes = " . $length . "<br>";
          > >
          > > my $fileup = $Request->{FileUpload}{uploadedfile};
          > > my $filehandle = $fileup->{FileHandle};
          > > my $PostedData = "";
          > > print "PostedData = " . $PostedData . "<br>";
          > > print "Length = " . length($PostedData) . "<br>";
          > > my $in_buffer;
          > > while (read($filehandle, $in_buffer, 1024))
          > > {
          > > print "a";
          > > $PostedData .= $in_buffer; # Equivalent to
          > > $PostedData =
          > > $PostedData . $in_buffer, except .= is shorter and faster.
          > > # data from the uploaded file read into $PostedData
          > > }
          > >
          > > my $ContentType = $fileup->{ContentType};
          > > print "ContentType = " . $ContentType . "<br>";
          > >
          > > print "PostedData = " . $PostedData . "<br>";
          > > print "Length = " . length($PostedData) . "<br>";
          > > # As always, watch for line breaks.
          > >
          > > __END__
          > >
          > > HTH,
          > > --Quentin
          >
          > Fantastic. That was the problem!
          >
          > I love it when the fix is so simple. It looks like I don't
          > need CGI in the end but then I guess it's because my form is
          > only posting the file so there's nothing to seperate? Seems
          > to work anyway I can upload a PDF and return it and just
          > tested it with BinaryWrite also and the PDF opens in Acrobat
          > Reader! Cool.
          >
          > Many thanks :-)
          >
          >
          > Tim.
          >

          Ah, I spoke to soon. It turns out the code that processes the data is
          expecting the full MIME multipart/form stuff (this is a port from an IIS
          app. It decodes the header internally in a bit of C++). So although I've got
          just the file itself, I need all the MIME header surrounding it.

          So I guess this is where CGI.pm comes in? Thing is though I don't want to
          use CGI to dynamically create the form or write to a temp file which is what
          the samples seem to do, I just want to get the full data with MIME headers
          (without CGI breaking it up for me).

          I've tried the equivalent of what we do in IIS which is...

          $Request->ServerVariables("CONTENT_TYPE");

          but this gives me a collection hash. If I add ->Item() onto the end I get
          something like this...

          multipart/form-data; boundary=---------------------------7d222cc5a02e4

          That's sort of along the lines but I think our code is expecting more than
          that. $fileup->{ContentType} gives me the content type (e.g.
          'application/pdf') but that's too little information it seems. Our C++ code
          is expecting a content type string with multipart/form and various things it
          can decode and then seems to be expecting the data itself to be wrapped up
          in MIME headers too (whereas I'm just getting the raw data).

          Hmm, any ideas? Anyway, looks like I'll have to get to grips with MIME a bit
          more (and our code).


          Cheers,

          Tim.

          ---------------------------------------------------------------------
          To unsubscribe, e-mail: asp-unsubscribe@...
          For additional commands, e-mail: asp-help@...
        • Josh Chamas
          ... CGI.pm is used internally by Apache::ASP to do its file upload processing. If you look at the Apache::ASP::Request object you will see how it gets
          Message 4 of 11 , Jul 12, 2002
          • 0 Attachment
            Tim Moore wrote:
            >
            > Ah, I spoke to soon. It turns out the code that processes the data is
            > expecting the full MIME multipart/form stuff (this is a port from an IIS
            > app. It decodes the header internally in a bit of C++). So although I've got
            > just the file itself, I need all the MIME header surrounding it.
            >
            > So I guess this is where CGI.pm comes in? Thing is though I don't want to
            > use CGI to dynamically create the form or write to a temp file which is what
            > the samples seem to do, I just want to get the full data with MIME headers
            > (without CGI breaking it up for me).
            >

            CGI.pm is used internally by Apache::ASP to do its file upload
            processing. If you look at the Apache::ASP::Request object
            you will see how it gets invoked. If you can see a hook into
            CGI.pm that we could add to make Apache::ASP work better for you,
            please feel free to provide a patch.

            The biggest deficit here that I see is by using CGI.pm for
            the processing, we lose access to the raw file upload data
            that you need. So, I might consider implementing the file
            upload processsing natively in Apache::ASP, but I see that
            in being quite a ways off yet. What I think you will find
            greater power in here is creating a mod_perl handler for this
            special case, so you have access to the file upload directly
            from Apache API, and you can do whatever you need to in
            this way.

            You could finally consider fixing the C++ that had the
            data requirements that it has. This might simplify
            things in the long term anyway.

            --Josh
            ________________________________________________________________
            Josh Chamas, Founder phone:714-625-4051
            Chamas Enterprises Inc. http://www.chamas.com
            NodeWorks Link Checking http://www.nodeworks.com


            ---------------------------------------------------------------------
            To unsubscribe, e-mail: asp-unsubscribe@...
            For additional commands, e-mail: asp-help@...
          • Tim Moore
            ... Ah, now I understand, so by saying it s done with CGI it doesn t mean the user has to write CGI code just that Apache::ASP uses it internally. Sounds like
            Message 5 of 11 , Jul 15, 2002
            • 0 Attachment
              > -----Original Message-----
              > From: Josh Chamas [mailto:josh@...]
              > Sent: 12 July 2002 23:13
              > To: Tim Moore
              > Cc: 'Quentin Smith'; 'asp@...'
              > Subject: Re: Uploading files
              >
              >
              > Tim Moore wrote:
              > >
              > > Ah, I spoke to soon. It turns out the code that processes
              > the data is
              > > expecting the full MIME multipart/form stuff (this is a
              > port from an IIS
              > > app. It decodes the header internally in a bit of C++). So
              > although I've got
              > > just the file itself, I need all the MIME header surrounding it.
              > >
              > > So I guess this is where CGI.pm comes in? Thing is though I
              > don't want to
              > > use CGI to dynamically create the form or write to a temp
              > file which is what
              > > the samples seem to do, I just want to get the full data
              > with MIME headers
              > > (without CGI breaking it up for me).
              > >
              >
              > CGI.pm is used internally by Apache::ASP to do its file upload
              > processing. If you look at the Apache::ASP::Request object
              > you will see how it gets invoked. If you can see a hook into
              > CGI.pm that we could add to make Apache::ASP work better for you,
              > please feel free to provide a patch.
              >
              > The biggest deficit here that I see is by using CGI.pm for
              > the processing, we lose access to the raw file upload data
              > that you need. So, I might consider implementing the file
              > upload processsing natively in Apache::ASP, but I see that
              > in being quite a ways off yet. What I think you will find
              > greater power in here is creating a mod_perl handler for this
              > special case, so you have access to the file upload directly
              > from Apache API, and you can do whatever you need to in
              > this way.
              >
              > You could finally consider fixing the C++ that had the
              > data requirements that it has. This might simplify
              > things in the long term anyway.

              Ah, now I understand, so by saying it's done with CGI it doesn't mean the
              user has to write CGI code just that Apache::ASP uses it internally.

              Sounds like what I need to do, given I don't have much time to achieve what
              I have to do, is to change our code to not rely on the extra MIME header
              information (code split between Windows/IIS which gets that stuff and has to
              decode it and Unix/Apache which doesn't). I think I can get away without
              needing the extra info anyway.

              Cheers,


              Tim.

              ---------------------------------------------------------------------
              To unsubscribe, e-mail: asp-unsubscribe@...
              For additional commands, e-mail: asp-help@...
            • Tim Moore
              ... Oh, one question... what happens if you have a multiple file upload in the form? Not actually sure if that s possible but at a guess the MIME stuff in IIS
              Message 6 of 11 , Jul 15, 2002
              • 0 Attachment
                > -----Original Message-----
                > From: Tim Moore
                > Sent: 15 July 2002 11:05
                > To: 'Josh Chamas'
                > Cc: 'Quentin Smith'; 'asp@...'
                > Subject: RE: Uploading files
                >
                >
                > > -----Original Message-----
                > > From: Josh Chamas [mailto:josh@...]
                > > Sent: 12 July 2002 23:13
                > > To: Tim Moore
                > > Cc: 'Quentin Smith'; 'asp@...'
                > > Subject: Re: Uploading files
                > >
                > >
                > > Tim Moore wrote:
                > > >
                > > > Ah, I spoke to soon. It turns out the code that processes
                > > the data is
                > > > expecting the full MIME multipart/form stuff (this is a
                > > port from an IIS
                > > > app. It decodes the header internally in a bit of C++). So
                > > although I've got
                > > > just the file itself, I need all the MIME header surrounding it.
                > > >
                > > > So I guess this is where CGI.pm comes in? Thing is though I
                > > don't want to
                > > > use CGI to dynamically create the form or write to a temp
                > > file which is what
                > > > the samples seem to do, I just want to get the full data
                > > with MIME headers
                > > > (without CGI breaking it up for me).
                > > >
                > >
                > > CGI.pm is used internally by Apache::ASP to do its file upload
                > > processing. If you look at the Apache::ASP::Request object
                > > you will see how it gets invoked. If you can see a hook into
                > > CGI.pm that we could add to make Apache::ASP work better for you,
                > > please feel free to provide a patch.
                > >
                > > The biggest deficit here that I see is by using CGI.pm for
                > > the processing, we lose access to the raw file upload data
                > > that you need. So, I might consider implementing the file
                > > upload processsing natively in Apache::ASP, but I see that
                > > in being quite a ways off yet. What I think you will find
                > > greater power in here is creating a mod_perl handler for this
                > > special case, so you have access to the file upload directly
                > > from Apache API, and you can do whatever you need to in
                > > this way.
                > >
                > > You could finally consider fixing the C++ that had the
                > > data requirements that it has. This might simplify
                > > things in the long term anyway.
                >
                > Ah, now I understand, so by saying it's done with CGI it
                > doesn't mean the user has to write CGI code just that
                > Apache::ASP uses it internally.
                >
                > Sounds like what I need to do, given I don't have much time
                > to achieve what I have to do, is to change our code to not
                > rely on the extra MIME header information (code split between
                > Windows/IIS which gets that stuff and has to decode it and
                > Unix/Apache which doesn't). I think I can get away without
                > needing the extra info anyway.
                >

                Oh, one question... what happens if you have a multiple file upload in the
                form?

                Not actually sure if that's possible but at a guess the MIME stuff in IIS
                would let you have multiple files under one 'submit'. I think I've seen
                sites that do something like that.

                As through Apache::ASP just seems to return the file itself there would be
                no boundaries to break up the files.

                Not that I need multiple file upload yet but I can see it being added to our
                project at some point.


                Cheers,

                Tim.

                ---------------------------------------------------------------------
                To unsubscribe, e-mail: asp-unsubscribe@...
                For additional commands, e-mail: asp-help@...
              • Tim Moore
                ... [] ... Ah, it seems I do need the rest of the form data. More is submitted than just the file so I need data from some other fields in the form, and these
                Message 7 of 11 , Jul 15, 2002
                • 0 Attachment
                  > -----Original Message-----
                  > From: Tim Moore
                  > Sent: 15 July 2002 11:18
                  > To: 'Josh Chamas'
                  > Cc: 'Quentin Smith'; 'asp@...'
                  > Subject: RE: Uploading files
                  >
                  []
                  >
                  > Oh, one question... what happens if you have a multiple file
                  > upload in the form?
                  >
                  > Not actually sure if that's possible but at a guess the MIME
                  > stuff in IIS would let you have multiple files under one
                  > 'submit'. I think I've seen sites that do something like that.
                  >
                  > As through Apache::ASP just seems to return the file itself
                  > there would be no boundaries to break up the files.
                  >
                  > Not that I need multiple file upload yet but I can see it
                  > being added to our project at some point.
                  >
                  >

                  Ah, it seems I do need the rest of the form data. More is submitted than
                  just the file so I need data from some other fields in the form, and these
                  are dynamic. So I need a way of either getting all the form data (noting
                  that at run time I don't know the field names because these are dynamically
                  generated), or the whole multipart/form-data thing with file.

                  For info, in the IIS version of our pages, we just do BinaryRead and pass
                  the binary data into our COM objects with some C++ code which then decodes
                  the Mime stuff and the uploaded file. In Apache::ASP I'm using SWIG to talk
                  to the same C++ code (running on Unix of course. SWIG is just a replacement
                  for COM in our case).

                  P.S. What does the Mime-Header return?

                  e.g. $Request->FileUpload('upload_file', 'Mime-Header');

                  I seem to get a collection but I'm having trouble parsing it (seems to be a
                  collection of collections but I'm probably doing something wrong - perl just
                  isn't my thing ;-) ).

                  and if I use the temp file, what does that contain, just the upload file or
                  more than that?

                  Cheers,

                  Tim.

                  ---------------------------------------------------------------------
                  To unsubscribe, e-mail: asp-unsubscribe@...
                  For additional commands, e-mail: asp-help@...
                • Tim Moore
                  ... [] ... Sorry, me again ;-) I think what I m after is what you d get as a result of... while( ) { print; } (as described here:
                  Message 8 of 11 , Jul 15, 2002
                  • 0 Attachment
                    > -----Original Message-----
                    []
                    >
                    > Ah, it seems I do need the rest of the form data. More is
                    > submitted than just the file so I need data from some other
                    > fields in the form, and these are dynamic. So I need a way of
                    > either getting all the form data (noting that at run time I
                    > don't know the field names because these are dynamically
                    > generated), or the whole multipart/form-data thing with file.
                    >
                    > For info, in the IIS version of our pages, we just do
                    > BinaryRead and pass the binary data into our COM objects with
                    > some C++ code which then decodes the Mime stuff and the
                    > uploaded file. In Apache::ASP I'm using SWIG to talk to the
                    > same C++ code (running on Unix of course. SWIG is just a
                    > replacement for COM in our case).
                    >
                    > P.S. What does the Mime-Header return?
                    >
                    > e.g. $Request->FileUpload('upload_file', 'Mime-Header');
                    >
                    > I seem to get a collection but I'm having trouble parsing it
                    > (seems to be a collection of collections but I'm probably
                    > doing something wrong - perl just isn't my thing ;-) ).
                    >
                    > and if I use the temp file, what does that contain, just the
                    > upload file or more than that?
                    >


                    Sorry, me again ;-)

                    I think what I'm after is what you'd get as a result of...

                    while(<>) {
                    print; }

                    (as described here: http://www.cs.tut.fi/~jkorpela/forms/testing.html)

                    so that you get all the multipart/form-data stuff


                    e.g.

                    -----------------------------7d21fd7b3170254
                    Content-Disposition: form-data; name="textfield"

                    dfg
                    -----------------------------7d21fd7b3170254
                    Content-Disposition: form-data; name="filefield";
                    filename="D:\dev\Acrobat5_SDK\Documentation\index.pdx"
                    Content-Type: application/octet-stream

                    etc.


                    However, if I stick this in an ASP page I get nothing ???. Same goes for
                    reading anything from STDIN.

                    I think I'm going outside the bounds of Apache::ASP. Does Apache::ASP by any
                    chance grab the raw input before I get a chance to get it?



                    Cheers,

                    Tim.

                    ---------------------------------------------------------------------
                    To unsubscribe, e-mail: asp-unsubscribe@...
                    For additional commands, e-mail: asp-help@...
                  • Josh Chamas
                    ... If you still need this, we might get you a config like: PerlSetVar FileUploadProcess 0 Default 1, if set to 0 then Apache::ASP will not set up the
                    Message 9 of 11 , Jul 17, 2002
                    • 0 Attachment
                      Tim Moore wrote:
                      >
                      > Sorry, me again ;-)
                      >
                      > I think what I'm after is what you'd get as a result of...
                      >
                      > while(<>) {
                      > print; }
                      >

                      If you still need this, we might get you a config like:

                      PerlSetVar FileUploadProcess 0

                      Default 1, if set to 0 then Apache::ASP will not set up the
                      $Request->FileUpload data from CGI, instead letting you read
                      the data from <STDIN> directly, or possibly even from
                      $Request->BinaryRead

                      --Josh
                      ________________________________________________________________
                      Josh Chamas, Founder phone:714-625-4051
                      Chamas Enterprises Inc. http://www.chamas.com
                      NodeWorks Link Checking http://www.nodeworks.com


                      ---------------------------------------------------------------------
                      To unsubscribe, e-mail: asp-unsubscribe@...
                      For additional commands, e-mail: asp-help@...
                    • Tim Moore
                      ... Cheers, may be useful although I ve got a workaround now. Not very nice but I ve basically created my own MIME strings for each form field, loop through
                      Message 10 of 11 , Jul 18, 2002
                      • 0 Attachment
                        > -----Original Message-----
                        > From: Josh Chamas [mailto:josh@...]
                        > Sent: 17 July 2002 20:02
                        > To: Tim Moore
                        > Cc: 'Quentin Smith'; 'asp@...'
                        > Subject: Re: Uploading files
                        >
                        >
                        > Tim Moore wrote:
                        > >
                        > > Sorry, me again ;-)
                        > >
                        > > I think what I'm after is what you'd get as a result of...
                        > >
                        > > while(<>) {
                        > > print; }
                        > >
                        >
                        > If you still need this, we might get you a config like:
                        >
                        > PerlSetVar FileUploadProcess 0
                        >
                        > Default 1, if set to 0 then Apache::ASP will not set up the
                        > $Request->FileUpload data from CGI, instead letting you read
                        > the data from <STDIN> directly, or possibly even from
                        > $Request->BinaryRead
                        >

                        Cheers, may be useful although I've got a workaround now. Not very nice but
                        I've basically created my own MIME strings for each form field, loop through
                        the fields outputing these divided by the boundary string (which you I get
                        from the CONTENT_TYPE server variable), and then append the uploaded file at
                        the appropriate point. All of these in a scalar seems to emulate what I'd
                        normally get although it's not very flexible and fixed to the format of my
                        form. Anyway, this lets me get all the form data in through one scalar and
                        means I don't have to change the C++ code it goes into (which is good
                        because that same code has to work with IIS too). If you do get the above
                        config at some point that would be great.


                        Best Regards,

                        Tim

                        ---------------------------------------------------------------------
                        To unsubscribe, e-mail: asp-unsubscribe@...
                        For additional commands, e-mail: asp-help@...
                      Your message has been successfully submitted and would be delivered to recipients shortly.