Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/atomjoy/curlsendfile

Php curl upload class.
https://github.com/atomjoy/curlsendfile

curl php php-curl php-oop php7 post upload upload-images

Last synced: 18 days ago
JSON representation

Php curl upload class.

Awesome Lists containing this project

README

        

# CurlSendFile Php class
Send big files with php curl

### Set php.ini
```bash
# In php.ini only
file_uploads = On
allow_url_fopen = Off
allow_url_include = Off

# In php.ini or in .user.ini in local directory
max_execution_time = 40000

max_input_time = 40000
max_input_vars = 100

upload_max_filesize = 900M
post_max_size = 900M
```
### Send file with curl
```php
Send("http://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();
}
?>
```

### Composer require
Install from command line (not active)
```bash
# Add
composer require atomjoy/curlsendfile

# Or
composer require atomjoy/curlsendfile:1.0
composer require atomjoy/curlsendfile:stable

# Install, update
composer update

# If you need to update the autoloader
composer dump-autoload -o
```

Install library from composer.json
```json
{
"name": "acme/blog",
"repositories": [
{
"type": "vcs",
"url": "https://github.com/atomjoy/curlsendfile"
}
],
"require": {
"atomjoy/curlsendfile": "~1.0"
}
}
```