Open alfuken opened 10 years ago
Curl.put(url) do|http| http.put_data = File.read(file) end
Should work.?
With small files? Yes, it probably should. But try to upload 100Mb file, and you'll end up with memory eating monster, which is, obviously, not a best choice.
What's interesting: Curl itself, using command line, uploads files just fine, without cluttering up the memory. But using a system() call to upload a file is even worse solution than using a memory-eating-monster there.
Hi,
I'm writing a WebDav client using Curb for Yandex.Disk, everything was perfect untill I started to write PUT (file upload) functionality.
Please, see description here: http://api.yandex.com/disk/doc/dg/reference/put.xml
The thing is - I can NOT upload a file using Curl - it always have a length of 0 bytes after request.
Code I'm using:
I've tried setting filename variable to different values - full path, relaive path, filename, nil, empty string; using POST; using post_body instead of put_data; with and without multipart. Zero luck.
So, my question is, HOW do I upload that damn file?..