lhttpc
lhttpc copied to clipboard
multipart file upload example?
I'm having trouble figuring out how to perform a multipart file upload and don't see any examples and haven't found anything via google. Any chance you could add one?
Do you mean the partial upload feature or chunked encoding?
Ryan Flynn [email protected] wrote:
I'm having trouble figuring out how to perform a multipart file upload and don't see any examples and haven't found anything via google. Any chance you could add one?
Reply to this email directly or view it on GitHub: https://github.com/oscarh/lhttpc/issues/5
Yes, in that POST and chunked transfer encoding is not multipart uploading (http://www.ietf.org/rfc/rfc2388.txt).
I am trying to reproduce the results of the following multipart curl upload:
pizza@pizza:~$ echo -n a > 1byte
pizza@pizza:~$ nc -l 8888 &
[1] 25085
pizza@pizza:~$ curl -X POST -F file=@1byte http://localhost:8888/
POST / HTTP/1.1
User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
Host: localhost:8888
Accept: */*
Content-Length: 198
Expect: 100-continue
Content-Type: multipart/form-data; boundary=----------------------------0a833808c0ae
------------------------------0a833808c0ae
Content-Disposition: form-data; name="file"; filename="1byte"
Content-Type: application/octet-stream
a
------------------------------0a833808c0ae--
^C
[1]+ Stopped nc -l 8888
As far as I can tell lhttpc does not have this capability, but perhaps I'm missing something?
Related RFC: "Form-based File Upload in HTML" http://www.ietf.org/rfc/rfc1867.txt
Not sure I'll find the time to take a look at this, but if you ping etc, they're probably more active on their version of lhttpc.
Hmm, maybe you just need to provide the header:
Content-Type: multipart/form-data; boundary=----------------------------0a833808c0ae
?