PHP code example of vmorozov / laravel-file-uploads

1. Go to this page and download the library: Download vmorozov/laravel-file-uploads library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vmorozov / laravel-file-uploads example snippets


Vmorozov\FileUploads\FileUploadsServiceProvider::class

public function store(Request $request)
{   
    // This will upload your file to the default folder of selected in config storage
    Uploader::uploadFile($request->file('some_file'));
    
    // This will upload your file to the given as second parameter path of default storage
    Uploader::uploadFile($request->file('some_file'), 'path/to/upload');
    
    // This will upload your file to the given storage
    Uploader::uploadFile($request->file('some_file'), 'path/to/upload', 'storage_name');
    
    // This will also resize image to the given width and height
    Uploader::uploadFile($request->file('some_file'), 'path/to/upload', 'storage_name');
}

public function store(Request $request)
{   
    // This will upload your file to the default folder of selected in config storage
    Uploader::uploadBase64Image($request->input('image'));
    
    // This will upload your file to the given as second parameter path of default storage
    Uploader::uploadFile($request->input('image'), 'path/to/upload');
    
    // This will upload your file to the given storage
    Uploader::uploadFile($request->input('image'), 'path/to/upload', 'storage_name');
    
    // This will also resize image to the given width and height
    Uploader::uploadFile($request->input('image'), 'path/to/upload', 'storage_name');
}

php artisan vendor:publish

config/file_uploads.php