cURL / Mailing Lists / curl-library / Single Mail

curl-library

HTTP upload

From: Jim Leggett <jim_at_dbmsinc.com>
Date: Wed, 16 Jul 2014 15:10:18 -0500

I am fairly new to using curl and HTTP for that
matter, but have used it successfully to download
files, which is a two-part process of sending a
request for the file, which is then built, and
sending another request to download it. However,
I've been having problems getting file upload to
work. I've been tasked with implementing HTTP
upload of purchase order data to a distributor.
This is an excerpt from their documentation where
"{site name}" represents their site name:

"Sending Data:
Request Content Type: multipart/form-data
The site is: http://{site
name}/SecureWebFtp/Uploads
Form data: dealer (Your six digit
store number)
                     password (Your
password)
                     filerequest (The file you
are sending.)
                     uploadFile (The name of
the file you are sending (MIME content
type:text/plain).

Once you post your file, you will receive the
confirmation as part of the server response
header."

It's actually a two-part process: first, upload
the file and then, message the site that the file
was uploaded and request that they process the
file. The values are:

Dealer: 099990
Password: TM95
Filerequest: ORDER
UPloadfile: HANDYORD

The HANDYORD file is a simple fixed-field text
file containing typical order data like purchase
order number, SKU and quantity list, etc. After
many different attempts, the last two commands I
used were as follows, neither of which was
successful:

curl http://{site name}:80/SecureWebFtp/Uploads
--header "Content-Type:multipart/form-data" --form
"dealer=099990&password=TM95&uploadFile=HANDYORD&f
ilerequest=ORDER" --verbose -# --write-out "HTTP
upload successful!" --upload-file
/keypos/ftpinout/HANDYORD http://{site
name}/SecureWebFtp/Uploads/

curl --header "Content-Type:multipart/form-data"
--form "dealer=099990" --form "password=TM95"
--form "filerequest=ORDER" --form
"uploadFile=HANDYORD;type=text/plain" --verbose
--upload-file /keypos/ftpinout/HANDYORD
http://{site name}/SecureWebFtp/Uploads/
http://{site name}:80/SecureWebFtp/Uploads

I suspect it's just some detail I'm missing or my
lack of experience with curl and HTTP, but if
there is any way you can help with this I'd
greatly appreciate it.

Jim Leggett

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-07-18