| 1 |
<?php |
| 2 |
defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' ); |
| 3 |
|
| 4 |
/** |
| 5 |
* Create a CURLFile object. |
| 6 |
* |
| 7 |
* @since PHP 5.5 |
| 8 |
* |
| 9 |
* @param string $filename Path to the file which will be uploaded. |
| 10 |
* @param string $mimetype Mimetype of the file. |
| 11 |
* @param string $postname Name of the file to be used in the upload data. |
| 12 |
* @return string The CURLFile object. |
| 13 |
*/ |
| 14 |
if ( ! function_exists( 'curl_file_create' ) ) { |
| 15 |
function curl_file_create( $filename, $mimetype = '', $postname = '' ) { |
| 16 |
return "@$filename;filename=" |
| 17 |
. ( $postname ? $postname : basename( $filename ) ) |
| 18 |
. ( $mimetype ? ";type=$mimetype" : '' ); |
| 19 |
} |
| 20 |
} |