in reply to Problem in posting using LWP::UserAgent

The "ERROR" you are seeing is being printed by the php script ... presumably because it doesn't like your input. the HTTP status code itself is a 200, indicating that everything went fine at the communication layer.

As for your problem, if you take closer look at the form you are trying to fake out you might notice that it is using "multipart/form-data" as the encoding type ... that's very important to remember.

If you search arround for "multipart/form-data", you'll find this Q&A which quotes from important parts of the docs for the "POST" method that you should re-read to understand how to indicate (to both the POST method, and the server on the other end) that you want do do a "file upload"

  • Comment on Re: Problem in posting using LWP::UserAgent

Replies are listed 'Best First'.
Re: Re: Problem in posting using LWP::UserAgent
by nilay (Initiate) on Feb 09, 2004 at 12:52 UTC
    By Modifying, file=>"$file" to file=>"$file" I was able to upload files of size 1081465 bytes. But the upload fails when I try for bigger files like 2MB or more... What do I need to set to be able to upload bigger files ? Thanks.
      1. Are you sure the server isn't rejecting files bigger then 2MB? ... ie, can you send a file that big with your browser?
      2. Did you read *all* of the docs for the POST method ... all the way down to the section that talks about the <code$DYNAMIC_FILE_UPLOAD</code>
        Hi, 1. why can't I send bigger file thru browser ? What is the limitation, if there is any ? I really do not know. 2. Which doc should I read ? I found mention of DYNAMIC_FILE_UPLAOD in perldoc HTTP::Request::Common. But it mentions only about setting it to true value. And I tried , $DYNAMIC_FILE_UPLOAD = 1; which did not help. Can u suggest the actual way to use this variable. Thnaks. use HTTP::Request::Common ; use HTTP::Request::Common qw(POST $DYNAMIC_FILE_UPLOAD); $DYNAMIC_FILE_UPLOAD = 1; # make it defined (don't know why) But it made no differecne to the result .