Take the 2-minute tour ×
Server Fault is a question and answer site for 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">

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

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

Your Answer


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.