PHP code example of evgen-dev / plupload-for-laravel

1. Go to this page and download the library: Download evgen-dev/plupload-for-laravel 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/ */

    

evgen-dev / plupload-for-laravel example snippets


'providers' => [
    EvgenDev\LaravelPlupload\LaravelPluploadServiceProvider::class,
]

'aliases' => array(
    'Plupload' => EvgenDev\LaravelPlupload\Facades\Plupload::class,
),

return [
    'invalid_file_extension' => 'It is forbidden to upload .:extension files',

    'max' => [
        'file' => 'The :attribute field must not be greater than :max :units.',
    ]
];

Route::post('/upload', function(){
    return Plupload::receive('file', function($file){
        $file->move(storage_path() . '/plupload/', $file->getClientOriginalName());
        return true;
    });

});

use EvgenDev\LaravelPlupload\Filters\Filesize;

Route::post('/upload', function(){
    return Plupload::sizelimit(3, Filesize::FILE_SIZE_UNITS_MB)
    ->receive('file', function($file){
        $file->move(storage_path() . '/plupload/', $file->getClientOriginalName());
        return true;
    });
});

Route::post('/upload', function()
{
    return Plupload::extensions(['jpg', 'png', 'gif'])->receive('file', function($file){
        $file->move(storage_path() . '/plupload/', $file->getClientOriginalName());
        return true;
    });

});

use \EvgenDev\LaravelPlupload\Filters\Filesize;

Route::post('/upload', function()
{
    return Plupload::sizelimit(5, Filesize::FILE_SIZE_UNITS_MB)
    ->extensions(['jpg', 'png', 'gif'])
    ->receive('file', function($file){
        $file->move(storage_path() . '/plupload/', $file->getClientOriginalName());
        return 'ready';
    });
});

use EvgenDev\LaravelPlupload\Facades\Plupload;

public function upload(Request $request){
    return Plupload::sizelimit(5, Filesize::FILE_SIZE_UNITS_MB)
        ->extensions(['txt'])
        ->receive('file', function($file){
            $filename = uniqid().'.'.$file->extension();
            $file->move(storage_path() . '/plupload/', $filename);
            return ['success' => true, 'filename' => $filename];
        });
}

->withoutMiddleware([\App\Http\Middleware\VerifyCsrfToken::class]);

Route::post('/upload', function()
{
    return Plupload::receive('file', function($file){
        $file->move(storage_path() . '/plupload/', $file->getClientOriginalName());
        return true;
    });

})->withoutMiddleware([\App\Http\Middleware\VerifyCsrfToken::class]);
resources/lang/en/validation.php