[wp-hackers] POSTing a file via wp_remote_post
lists at rotorised.com
Fri Jan 11 11:59:31 UTC 2013
David Anderson wrote:
> Unfortunately the parameters for wp_remote_post are not well documented.
> Reading the source code, it looks like the argument 'stream' could be
> something to do with what I want. That appears to stream a file. But
> then what about the other parameters that needing posting too? How can I
> achieve what Curl is achieving, but using wp_remote_post? (Reading the
> whole file into memory is not an option - it could potentially be more
> than available memory).
The various parts there need to be converted into their HTTP
representations. The OAuth parts should be parsed by an OAuth library
into an Authorization header.
`filename` is probably passed as a Content-Disposition header, but I'm
not sure. `overwrite` should be passed in the URL as you're posting.
Your best bet is to work from the Dropbox API documentation:
Something like this would probably work:
$auth_header = ''; // use OAuth library here to generate this
'stream' => '/path/to/myfile.zip',
'headers' => array(
'Authorization' => $auth_header,
'Content-Disposition' => 'attachment; filename=myfolder/myfile.zip'
More information about the wp-hackers