Laravel File Uploader
This package take advantage of the Laravel Filesytem library., (*1)
Installation
Begin by installing this package through Composer. Edit your project's composer.json file to require ibox/uploader, (*2)
"require": {
"ibox/uploader": "~1.0"
}
Next, update Composer from the terminal:, (*3)
composer update
In config/filesystems.php update default key. This library will upload all files to the default option.
If you are uploading locally also update the root key to define were the files will be stored., (*4)
Usage
Example:, (*5)
In your HTML:, (*6)
<form action="/images" enctype="multipart/form-data" method="post">
<input type="file" name="image" multiple="multiple" required />
<input type="submit" value="Upload" />
</form>
In your controller:, (*7)
<?php
use Ibox\Uploader\Uploader;
class ImagesController extends Controller
{
public function store(Request $request, Uploader $uploader)
{
$path = 'some/path';
$imageNames = $uploader->upload($request->file(), $path);
}
}
NOTE: The secong parameter ($path), will only work for cloud storage, check config section., (*8)
Next features
Enable queue to faster responses., (*9)
License
This package is open source software licensed under the MIT license, (*10)