PHP code example of imnotjames / curlfile-compat
1. Go to this page and download the library: Download imnotjames/curlfile-compat library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
imnotjames / curlfile-compat example snippets
$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);