cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Text File Upload over HTTP with curl -F

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 28 Jul 2003 10:08:20 +0200 (CEST)

On Sat, 26 Jul 2003, Daniel F Reimann wrote:

> I am trying to upload a tab-separated text file over https to Amazon
> with curl. I do use curl for a number of things, but this is the first
> instance where I've had to use curl -F. I have searched for examples:
> the example on the tutorial page is more simple than what I am doing
> here and I searched in Google, I cannot get this thing to work. First,
> let me describe the working environment, so we're all on the same page.
> I am on a Cobalt RAQ 550 and I am using curl 7.10.3 (i686-pc-linux-gnu)
> libcurl/7.10.3 OpenSSL/0.9.6 zlib/1.1.4.
> Getting to a certain point with curl, formfind.pl yields the following:
>
> Input: NAME="customer_id" (HIDDEN)

Isn't this strange that the customer_id field doesn't have a value? Or is that
taken care of with cookies?

> /usr/local/bin/curl -b /tmp/cookies.txt -c /tmp/cookies.txt -o
> upload_3.html -A "Mozilla" -F UploadFileName=@/path/to/textfile.txt -F
> "customer_id=" -F "FileType=TabDelimited" -F
> "enable-expedited-shipping=Y" -F "ListingProgram=HybridSDP" -F
> "FileOperationType=PR" -L
> https://secure.amazon.com/exec/panama/seller-admin/catalog-upload/catalo
> g-upload-now

It certainly looks like a correct curl command line using -F.

> Previous curl commands have already signed me in, as required, and all of
> that works fine.
>
> Is there something I am obviously missing?

What doesn't work with this usage?

When it comes to -F uploads, I've noticed on several occations that sites tend
to do the most stupid checks of the data format. For example, starting with
curl 7.10.5, we "clone" the IE look for the "part separation strings" as many
sites can't deal with the boundary string curl used in previous versions.

I've also seen sites that refuse to accept file uploads in case the file name
doesn't start with "[LETTER]:" etc...

So, figuring out exactly where the problem is can be hard.

-- 
 Daniel Stenberg -- curl: been grokking URLs since 1998
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
Received on 2003-07-28