PHP code example of viloveul / media

1. Go to this page and download the library: Download viloveul/media 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/ */

    

viloveul / media example snippets




$serverRequest = Viloveul\Http\Server\RequestFactory::fromGlobals();

$uploader = new Viloveul\Media\Uploader($serverRequest, [
	'target' => '/path/uploads'
]);

// upload all uploaded files
$uploader->upload('*', function ($results, $errors) {
	dd($results);
});

// upload specific index of $_FILES
$uploader->upload('your_input_field', function ($results, $errors) {
	dd($results);
});