This Laravel package contains functions for:
- Generating unique filename
- Saving uploaded file on a folder
- Deleting file on a folder
Uploaded files will be saved on the storage folder (storage\app\public).
composer require kapitannwel/laravelfileupload
use kapitannwel\LaravelFileUpload\LaravelFileUpload;
$file = $request->file('element');
LaravelFileUpload::generateUniqueFileName($file->getClientOriginalName(), 'folder_name');
LaravelFileUpload::deleteFile($filename, 'folder_name');
LaravelFileUpload::saveFile('folder_name', $file, $filename);
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.