mobilemaster / laravel-file-input
Laravel 5/File Input - Handle large file uploads
Installs: 30
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:JavaScript
Requires
- php: >=5.5.0
- illuminate/support: ^5.1
Requires (Dev)
- phpunit/phpunit: ^4.0
This package is not auto-updated.
Last update: 2024-05-06 05:12:51 UTC
README
Laravel bootstrap file input support.
Handeling chunked uploads.
1. Installation
-
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.
2. Updating
-
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
3. Sending files
There are 2 ways to send files with this plugin.
1. Simple File Input builder
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.
2. Extended File Input builder
echo FileInput::init([ 'uploadUrl' => 'upload', ])->withSuffix('current')->createHtml();
4. Receiving files
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, ]; }