Laravel bootstrap file input support.
Handeling chunked uploads.
-
Require the package using composer:
composer require mobilemaster/laravel-file-input
-
Add the service provider to the
providers
inconfig/app.php
:Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider
MobileMaster\LaravelFileInput\ServiceProvider::class,
-
Publish the public assets:
php artisan vendor:publish --provider="MobileMaster\LaravelFileInput\ServiceProvider" --tag=assets
-
Configuration
First, publish the configuration file:
php artisan vendor:publish --provider="MobileMaster\LaravelFileInput\ServiceProvider" --tag=config
Now, edit
config/fileinput.php
to configure the lang.
-
To update this package, first update the composer package:
composer update mobilemaster/laravel-file-input
-
Then, publish the public assets with the
--force
flag to overwrite existing filesphp artisan vendor:publish --provider="MobileMaster\LaravelFileInput\ServiceProvider" --tag=assets --force
There are 2 ways to send files with this plugin.
To use the builder for creating send form you can use this function:
echo FileInput::make([
'uploadUrl' => 'upload',
]);
Note: The options given to the make function are found on in the file input documentation.
echo FileInput::init([
'uploadUrl' => 'upload',
])->withSuffix('current')->createHtml();
Use this controller to receive a file on the url /upload
.
public function imageFileUpload(Request $request)
{
$path = $request->file('file_data')->store('uploads');
return [
'error' => NULL,
'path' => $path,
];
}