file-upload-package / laravel-file-upload
A Laravel package for easy file uploads
v1.0.0
2024-09-28 14:37 UTC
Requires
- php: ^7.3|^8.0
- illuminate/http: ^8.0|^9.0|^10.0
- illuminate/support: ^8.0|^9.0|^10.0
Requires (Dev)
- orchestra/testbench: ^6.0|^7.0|^8.0
- phpunit/phpunit: ^9.0
README
Description
Laravel file upload is a package that allows to you upload a single file or multiple files simply.
Installation
composer require file-upload-package/laravel-file-upload
Publish Config File
php artisan vendor:publish --tag=config
1- Using the Package in Your Application
Here are a few short examples of what you can do:
$post = new Post(); //... $post->image = FileUpload::uploadSingle($request->file('image')); $post->save();
You can add folder path.
$post = new Post(); //... $post->image = FileUpload::uploadSingle($request->file('iamge'),'posts'); $post->save(); ***Dont forget*** run this command. ```bach php artisan storage:link
2- MediaUploadService class
$post = new Post(); //... $post->files = FileUpload::uploadMultiple($request->file('files')); $post->save();
3- Old File Delete
$fileUpload->oldFileDelete($oldFilePath);