PHP code example of file-upload-package / laravel-file-upload

1. Go to this page and download the library: Download file-upload-package/laravel-file-upload 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/ */

    

file-upload-package / laravel-file-upload example snippets


$post = new Post();
//...
$post->image =  FileUpload::uploadSingle($request->file('image'));

$post->save();

$post = new Post();
//...
$post->image =  FileUpload::uploadSingle($request->file('iamge'),'posts');

$post->save();

***Dont forget*** run this command.

$post = new Post();
//...
$post->files =  FileUpload::uploadMultiple($request->file('files'));

$post->save();

$fileUpload->oldFileDelete($oldFilePath);
bach
php artisan vendor:publish --tag=config