arthur / uploader
This package provides a flexible way to upload file in Laravel application
This package's canonical repository appears to be gone and the package has been frozen as a result.
Requires
- php: >=5.5.0
- illuminate/console: ~5.0
- illuminate/support: ~5.0
Requires (Dev)
- illuminate/database: ~5.0
This package is not auto-updated.
Last update: 2021-03-06 09:13:01 UTC
README
#Uploader
This package provides a flexible way to upload file in Laravel application
##Installation
-
Add this
"arthur/uploader": "dev-master"
package to the list of required packages, insidecomposer.json
-
Go to
app/config/app.php
- add to providers
'Arthur\Uploader\UploaderServiceProvider'
- add to aliases
'Uploader' => 'Arthur\Uploader\Uploader'
-
Run
composer update
-
Run
php artisan vendor:publish
to publishuploader.php
config file -
Run
php artisan migrate
to createuploaded_files
table -
Run
php artisan make:uploader
to createUploaderController.php
inapp\Http\Controllers
folder with already existing upload logic, and upload route inroutes/web.php
file
You can now access Uploader with the Uploader
alias.
##Simple example
Uploader::upload($file);
#Functions
##upload($file)
$file should be instance of Illuminate\Http\UploadedFile
and will return object instanceof Arthur\Uploader\UploadedFile
.
##transform($file)
$file should be instance of Arthur\Uploader\UploadedFile
and will return array with all information about uploaded file including thumbnail url according to uploader.php
config file.
##moveFile($file, $storage)
$file should be instance of Arthur\Uploader\UploadedFile
, $storage is related path to your storage folder. This will move file to another storage directory and update file storage field in uploaded_table
##removeFile($file)
$file should be instance of Arthur\Uploader\UploadedFile
and will remove file from storage,