Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

I'm trying to make a simple web call work in command line mode and what I would like to do is:

  1. send a document file to
  2. receive as the response a PDF file

I can see that I can't send a file using curl and download other using the same call, so I was trying to make 2 calls where in the first send I would get an unique identifier that would be used to retrieve the PDF file on the second call.

For example:

@echo off
set var = curl --form upload=@localfilename
echo The Unique Identifier is "%var%"
curl -O "newfile.pdf"

But I'm getting error upon creating the file:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
Warning: Failed to create the file
Warning: get-file.ashx?id=00000000-0000-0000-0000-000000000000
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (23) Failed writing body (0 != 1132)

It seems that it does not care about newfile.pdf and tries to create the file using the same name of the web page...

How would I change my script in order to work?

share|improve this question
up vote 1 down vote accepted

forgot to read

Specifying the output as '-' (a single dash) will force the output to be done to stdout.

so, changing -O to --O did the trick :)

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.