Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

The form html from the page I'm trying to upload to is as follows:

<form action="upload_handler" method="POST" enctype="multipart/form-data">
    <input type="file" name="myfile">
    <input type="submit" name="submit" value="Upload">
</form>

I've tried the following, but neither works:

curl -b cookies.txt -F "myfile=@/xxx/java_pid30806.hprof;submit=Upload" http://xxx.yyy.com > curlout.txt

curl -b cookies.txt --data-binary @/xxx/java_pid30806.hprof http://xxx.yyy.com > curlout.txt

,where cookies.txt contains the session cookie obtained from succesfully logging in via a previous curl command.

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

First of all your command have a mistake: -b is not used with cookiejar i.e cookie file. You should use -c. -b is to specify individual cookie.

Try this:

curl -c cookies.txt --form myfile=@/path/to/file --form submit=Upload http://xxx.yyy.com
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.