in reply to Re: How can I upload a file using HTTP POST with Content-Type=multipart/form-data?
in thread How can I upload a file using HTTP POST with Content-Type=multipart/form-data?

Read further down in the LWP::Request::Common:
If you set the $DYNAMIC_FILE_UPLOAD variable (exportable) to some TRUE value, then you get back a request object with a subroutine closure as the con- tent attribute. This subroutine will read the content of any files on demand and return it in suitable chunks. This allow you to upload arbitrary big files without using lots of memory. You can even upload infinite files like /dev/audio if you wish. Another difference is that there will be no Content-Length header defined for the request if you use this fea- ture. Not all servers (or server applications) like this.
Still no reason to write the code yourself. Remember... LWP has had many many man-years of coding put into it. Don't reinvent the wheel.

-- Randal L. Schwartz, Perl hacker

  • Comment on RE: Answer: How can I upload a file using HTTP POST with Content-Type=multipart/form-data?
  • Download Code

Replies are listed 'Best First'.
RE: RE: Answer: How can I upload a file using HTTP POST with Content-Type=multipart/form-data?
by bhess (Initiate) on Sep 19, 2000 at 15:14 UTC
    I have tried using this with no luck in the past and gave up. I wrote a simple client script using HTTP::Request::Common and had it working with small files and then set the DYNAMIC_FILE_UPLOAD variable at the beginning of the script. And this seemed to break it. Is there something else I need to do? Also, I am using Apache as my server. Is there some setting in Apache that I will need because of no Content-Length? Thanks
      Show your 'simple script' and we might find out what went wrong...

      Jouke Visser, Perl 'Adept'
      Hi, I am looking for this exact solution... Do you have an example I could possibly use? Thanks in advance a.fitzpatrick@exec.com.au