Looking to hire Laravel developers? Try LaraJobs

laravel-file-upload maintained by file-upload-package

Description
A Laravel package for easy file uploads
Last update
2024/09/28 16:37 (dev-main)
License
Downloads
5

Comments
comments powered by Disqus

Laravel File Upload Package

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);