Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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" > curlout.txt

curl -b cookies.txt --data-binary @/xxx/java_pid30806.hprof > curlout.txt

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

share|improve this question
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
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.