cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Difficulty uploading files via http

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 5 May 2008 09:47:05 +0200 (CEST)

On Mon, 5 May 2008, Tim Post wrote:

> <form enctype="multipart/form-data" action="kget.php" method="post">
> <input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
> <input name="uploaded_file" type="file" />
> <input type="submit" name="go" value="Upload" />
> </form>
>
> curl -F uploaded_file=/home/tpost/desktop/patch -F go=Upload [url]

You forgot the magic @ letter! Try:

   curl -F uploaded_file=@/home/tpost/desktop/patch -F go=Upload [url]

>> Expect: 100-continue
>>
> < HTTP/1.1 417 Expectation Failed

This a broken http server (and yes lighttpd has been reported to be this
broken in the past), you better try the same operation without the Expect:
header:

  curl -H Expect: -F uploaded_file=@/home/tpost/desktop/patch -F go=Upload [url]

> As indicated above, I am using curl 7.15.4 (i486-pc-linux-gnu)
> libcurl/7.15.4 on an Ubuntu GNU/Linux (edgy) machine.

That's almost two years old so I do recommend considering an upgrade. Not that
I think your particular problems are because of that...

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2008-05-05