PHP code example of atomjoy / curlsendfile
1. Go to this page and download the library: Download atomjoy/curlsendfile 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/ */
atomjoy / curlsendfile example snippets
// Limits
set_time_limit(0);
ini_set('memory_limit', -1);
// Errors
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
// Import class with composer
/localhost/example/upload.php", 'example/img/wolf.jpg', ['my_post_id' => '1234567890', 'name' => 'Curl upload']);
// Params
$timeout = 60; // Timeout default: 60
$selfsigned = 1; // Allow selfsigned ssl 1 or 0 default: 1
$attr = 'my_file'; // Files form name $_FILES['my_file'] default: file
// Send with custom field name
echo $curl->Send("https://localhost/example/upload.php", 'example/img/wolf.jpg', ['id'=>'1234567890'], $timeout, $selfsigned, $attr);
}
catch(Exception $e)
{
echo $e->getMessage();
echo $e->getCode();
}
bash
# In php.ini only
file_uploads = On
allow_url_fopen = Off
allow_url_0000
max_input_time = 40000
max_input_vars = 100
upload_max_filesize = 900M
post_max_size = 900M