- Support Chunks jQuery-File-Upload $driver = 'fileapi';
- Support Chunks Dropzone $driver = 'dropzone';
- Support Chunks FileApi $driver = 'fileapi';
- Support Chunks Fine Uploader $driver = 'fine-uploader';
- Support Chunks Plupload $driver = 'plupload';
- Support Chunks Filepond $driver = 'filepond'
To get the latest version of Laravel Exceptions, simply require the project using Composer:
composer require recca0120/upload
publish
artisan vendor:publish --provider="Recca0120\Upload\UploadServiceProvider"
Controller
use Illuminate\Http\JsonResponse;
use Illuminate\Http\UploadedFile;
use Recca0120\Upload\UploadManager;
class UploadController extends Controller
{
public function upload(UploadManager $manager)
{
$driver = 'plupload'; // or 'fileapi'
$inputName = 'file'; // $_FILES index;
return $manager->driver($driver)->receive($inputName);
// or
return $manager
->driver($driver)
->receive($inputName, function (UploadedFile $uploadedFile, $path, $domain, $api) {
$filename = $uploadedFile->getBasename();
return new JsonResponse([
'name' => $uploadedFile->getClientOriginalName(),
'tmp_name' => $path.$filename,
'type' => $uploadedFile->getMimeType(),
'size' => $uploadedFile->getSize(),
'url' => $domain.$path.$filename,
]);
});
}
}
use Recca0120\Upload\Receiver;
use Illuminate\Http\JsonResponse;
require __DIR__.'/vendor/autoload.php';
$config = [
'chunks' => 'path_to_chunks',
'storage' => 'path_to_storage',
'domain' => 'http://app.dev/',
'path' => 'web_path'
];
Receiver::factory($config, 'fileapi')->receive('file')->send();
use Recca0120\Upload\Drivers\FileAPI;
use Recca0120\Upload\Receiver;
require __DIR__.'/vendor/autoload.php';
$config = [
'chunks' => 'path_to_chunks',
'storage' => 'path_to_storage',
'domain' => 'http://app.dev/',
'path' => 'web_path'
];
// if use Plupload, new Recca0120\Upload\Plupload
$receiver = new Receiver(new FileAPI($config));
// save to $config['storage'];
$receiver->receive('file')->send();