Compatibility library with CURLFile from PHP 5.5
This class abuses the fact that the PHP
CURLOPT_POSTFIELDS option will coerce classes to strings when
sending it as data, and outputs the older style of including files in the post data.
New school or old school, your choice.
If you're kicking it old school you've got to
Either way, the non-namespaced CURLFile will only be created if the class doesn't already exist. Same goes for the
Exactly the same as PHP's CURLFile'
$handle = curl_init('http://example.com'); $cfile = new CURLFile('puppy.jpg','image/jpeg','puppy_boquet'); // Assign POST data $data = array('test_file' => $cfile); curl_setopt($handle, CURLOPT_POST, true); curl_setopt($handle, CURLOPT_POSTFIELDS, $data); curl_exec($handle);