requirement : Laravel ^5.0
farshidrezaei/laravel-file-uploader
is a Laravel package which help you to upload your files easily.
To install through Composer, by run the following command:
composer require farshidrezaei/laravel-file-uploader
The package will automatically register a service provider.
Optionally, publish the package's configuration file by running:
php artisan vendor:publish --provider="farshidrezaei\fileUploader"
after install package you can use this syntax to upload your files:
FileUploader::file($request->file('your_file'))
->name('avatar')
->path('avatar')
->save();
you can use helper function, too:
fileUploader($request->file('your_file'))
->name('avatar')
->path('avatar')
->save();
this function create an instance of class with uploaded file then, set original file name as uploading file name. and set
public_path('files/' . Auth::id() . '/others/')
as uploading file path.
this function set $name as uploading file name.if $name be null, that will save with original name.
this function set $path as uploading file path that it will save there.
public_path('files/' . Auth::id() . '/' . $path . '/')
if $path be null, that will save in "others" subFolder.
public_path('files/' . Auth::id() . '/others/')
move file to specified path with specified name, and return file url.
The MIT License (MIT). Please see License File for more information.