arthur/uploader

There is no license information available for the latest version (dev-master) of this package.

This package provides a flexible way to upload file in Laravel application

dev-master 2017-07-12 14:49 UTC

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

  1. Add this "arthur/uploader": "dev-master" package to the list of required packages, inside composer.json

  2. Go to app/config/app.php

  • add to providers 'Arthur\Uploader\UploaderServiceProvider'
  • add to aliases 'Uploader' => 'Arthur\Uploader\Uploader'
  1. Run composer update

  2. Run php artisan vendor:publish to publish uploader.php config file

  3. Run php artisan migrate to create uploaded_files table

  4. Run php artisan make:uploader to create UploaderController.php in app\Http\Controllers folder with already existing upload logic, and upload route in routes/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,