I'm trying to make a simple web call work in command line mode and what I would like to do is:
- send a document file to http://domain.com/convert/
- 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 http://domain.com/send-file.ashx
echo The Unique Identifier is "%var%"
curl http://domain.com/get-file.ashx?id=%var% -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?
forgot to read
so, changing
-O
to--O
did the trick :)