1. Go to this page and download the library: Download slince/upload 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/ */
slince / upload example snippets
$builder = new Slince\Upload\UploadHandlerBuilder(); //create a builder.
$handler = $builder
->saveTo(__DIR__ . '/dst')
->getHandler();
$files = $handler->handle();
print_r($files);
$files['foo']->getUploadedFile()->getClientOriginalName(); // original name
$files['bar']['baz'][0]->getUploadedFile()->getClientOriginalExtension(); // original extension
$files['bar']['baz'][1]->getUploadedFile()->getClientMimeType(); // original mime type
function createS3Flysystem()
{
$client = new Aws\S3\S3Client([
'credentials' => [
'key' => 'your-key',
'secret' => 'your-secret'
],
'region' => 'your-region',
'version' => 'latest|version',
]);
$adapter = new League\Flysystem\AwsS3v3\AwsS3Adapter($client, 'your-bucket-name');
$flysystem = new League\Flysystem\Filesystem($adapter);
return $flysystem;
}
$builder = new Slince\Upload\UploadHandlerBuilder(); //create a builder.
$handler = $builder->setFilesystem(new Slince\Upload\Filesystem\Flysystem(createS3Flysystem()))
->getHandler();
$files = $handler->handle();
print_r($files);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.