[wp-trac] [WordPress Trac] #24156: If you submit file through wp curl it doesnt send boundary params for file mutlipart
WordPress Trac
noreply at wordpress.org
Thu Aug 8 09:58:17 UTC 2013
#24156: If you submit file through wp curl it doesnt send boundary params for file
mutlipart
--------------------------+----------------------
Reporter: samnani | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: HTTP | Version: 3.5.1
Severity: major | Resolution: wontfix
Keywords: has-patch |
--------------------------+----------------------
Comment (by markoheijnen):
I'm doing it like this and it seems to work fine:
{{{
$body = file_get_contents( $filepath );
$mime_type = '';
if ( extension_loaded( 'fileinfo' ) ) {
$finfo = new finfo;
$mime_type = $finfo->file( $filepath, FILEINFO_MIME );
}
elseif ( function_exists('mime_content_type') ) {
$mime_type = mime_content_type( $filepath );
}
$args = array(
'method' => 'PUT',
'headers' => array(
'Content-Type' => $mime_type,
'X-HTTP-Method-Override' => 'PUT'
),
'timeout' => 30,
'body' => $body,
);
$response = wp_remote_request( $url, $args );
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/24156#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list