file-upload-package/laravel-file-upload

A Laravel package for easy file uploads

v1.0.0 2024-09-28 14:37 UTC

This package is auto-updated.

Last update: 2025-06-28 17:14:02 UTC


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