| |
|
|
|
cURL Mailing List Monthly Index Single Mail
curl-users Mailing List Archives
Multipart form trouble
From: Oliver Maylen <oliver_maylen_at_hotmail.co.uk>
Date: Wed, 9 Sep 2009 22:21:52 +0000
Hi there,
I am writing a script with which I wish to implement the use of cURL to first login to a site and then using a multipart form upload two files and pass other data. However I am getting errors and I can not see where I am going wrong. Any input gratefully received.
Details:
OS is 32bit Linux,
1.) Firstly the login page:
curl -A 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5)' -H 'Content-Type: application/x-www-form-urlencoded' -b cookies.txt -c cookies.txt -d "username=myusername&password=mypassword" www.my-site.org/takelogin.php
The above works fine and logs in, saving the cookies....
2.) POST multipart form (note: includes 2 file uploads):
curl -A 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5)' -H 'Content-Type: multipart/form-data' -H 'Referer: http://www.my-site.org/upload.php' -b cookies.txt -c cookies.txt -F "MAX_FILE_SIZE=1000000" -F "file=@/path/to/filename.zip" -F "name=" -F "nfo=@/path/to/nfo.nfo" -F "color=0" -F "font=0" -F "size=0" -F "descr=" -F "type=42" www.my-site.org/takeupload.php
The first command logs in successfully and saves the cookies, but the above multipart post fails, with the error message, "Upload failed! Missing form data!"
I'm sure I am just using the commands incorrectly, so any guidance would be a real help. Verbose output shows the following:
* About to connect() to www.my-site.org port 80 (#0)
Regards,
Oliver
_________________________________________________________________
-------------------------------------------------------------------
These mail archives are generated by hypermail. |
Page updated November 12, 2010.
web site info