Skip to content

This is a helper function which will help to upload photo in Laravel.

Notifications You must be signed in to change notification settings

mhsun/laravel-photo-upload-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Photo Upload Helper for Laravel

This is a helper function that will help to upload a photo in Laravel. It will also help you to remove the previously uploaded file in case of an update or delete.

Installation

Add this file anywhere you like to place. You may want to put it in app/helper.php directory in a Laravel project. Then hit the command below to discover the file by the composer(dependency manager).

composer dump-autoload

Usage

// only for upload
if ($request->hasFile('image')) {
   $newFileName = uploadPhoto($request->file('image'), 'path/to/upload');
}

// upload with removing previous file (update or delete)
if ($request->hasFile('image')) {
   $newFileName = uploadPhoto($request->file('image'), 'path/to/upload', 'existing/path');
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update the tests as appropriate.

About

This is a helper function which will help to upload photo in Laravel.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages