curl-users
Re: Using -F
Date: Fri, 6 Oct 2000 08:12:30 +0200 (MET DST)
On Thu, 5 Oct 2000, Sven Rudolph wrote:
> I have problems using the -F option.
> I tried the following:
> curl --proxy proxy:8080 --proxy-user name:passwd -F
> "userfile=@testpic.jpg" http://www.server.tld/upload.php3
>
> The .jpg is 28711 Bytes, but when it arives at the server it has 28746
> Bytes and can't be displayed by a browser anymore.
> When I look at the picture on the server with an editor, I can see the
> following in the first line:
> "ntent-Transfer-Encoding: binary"
This is a clear indication that you're using a faulty receiving end.
> When I remove this line, the .jpg can be displayed by a browser again.
> Since my upload.php3 is just writing the file to disk, I must assume that
> curl is corrupting the file.
Not really, that piece of text you see included in the file is a header that
curl has included before the file contents. Your receiving end should've read
it, and if it didn't understand or care about the header it should just
ignore it.
> Is that a bug or a feature?
From my view, I think curl is following the RFC1867 defined syntax.
> Is there a workaround?
If you don't want or can fix your end, you can edit lib/formdata.c to not
send that particular header that seems to corrupt your file.
-- Daniel Stenberg -- curl project maintainer -- http://curl.haxx.se/Received on 2000-10-06