Download the PHP package voerro/laravel-file-uploader without Composer
On this page you can find all versions of the php package voerro/laravel-file-uploader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download voerro/laravel-file-uploader
More information about voerro/laravel-file-uploader
Files in voerro/laravel-file-uploader
Package laravel-file-uploader
Short Description A small helper class for easier file and image uploading in Laravel
License MIT
Informations about the package laravel-file-uploader
Laravel File Uploader
A very simple helper class that makes these tasks a walk in the park:
- replacing an old/existing file with a new one
- downsizing an image on upload
- deleting a file from a storage
- determining if a file is an image
Installation
Via composer:
For Laravel Below 5.5
Add the FileUploaderServiceProvider
to the providers
array of your config/app.php
configuration file:
Then add the Facade
to the aliases
array:
Basic Usage
Import the FileUploader
class like this:
Pass the uploaded file (an Illuminate\Http\UploadedFile
) instance to the make
method, then chain the upload
method, which will return the path to the newly stored file.
Methods
Static methods
Initialization:
Deleting a file (the method checks if the file exists to eliminate possible errors):
Determine if a file is an image. Pass to the method an UploadedFile instance or a string with a path to the file:
The following methods should be chained after the make
method.
Upload file under a specified name:
Replace an old file:
Replace an old file, store the new file under a specified name:
Downsize an image if it's bigger than the specified width and/or height (the aspect ratio will be saved). When called on a non-image file nothing would be happen, thus you don't need to manually check if the file is an image before deciding wether to call this method.
Crop and resize an image to fit the the specified dimensions (the same as ->fit()
from Intervention Image)
Call this method before calling any of the above methods, for example:
License
This is open-sourced software licensed under the MIT license.
All versions of laravel-file-uploader with dependencies
illuminate/support Version 5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.* || 5.9.* || ^6.
illuminate/http Version 5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.* || 5.9.* || ^6.
intervention/image Version ^2.4