Skip to content

Commit

Permalink
Updated Uploader to use curl_file_create()
Browse files Browse the repository at this point in the history
  • Loading branch information
electblake committed Aug 11, 2013
1 parent a764c3e commit 0ad2a66
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Uploader.php
Expand Up @@ -169,11 +169,15 @@ public static function call_api($action, $params, $options = array(), $file = NU
$ch = curl_init($api_url);

$post_params = array();
/**
* @todo support urls here
*/
if ($file) {

if (!preg_match('/^@|^https?:|^s3:|^data:[^;]*;base64,([a-zA-Z0-9\/+\n=]+)$/', $file)) {
$post_params["file"] = "@" . $file;
} else {
$post_params["file"] = $file;
$post_params['file'] = curl_file_create($file);
}
}

Expand Down

0 comments on commit 0ad2a66

Please sign in to comment.