PHP code example of sevens / uploader-trait

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

    

sevens / uploader-trait example snippets


use Seven\File\Uploader;

$uploader = new Uploader(
 string $destination = __DIR__.'/cdn', 
 array $allowedTypes = [ 'jpg' => 'image/jpeg', 'png' => 'image/png' ],
 int $sizeLimit =  5024768
);

$uploader->upload('image');

use Seven\File\Uploader;

class FileUploader extends Uploader{

 protected $destination = __DIR__.'/cdn';

 protected $allowedTypes = [ 'jpg' => 'image/jpeg', 'png' => 'image/png' ];

 protected $sizeLimit =  5024768;

}

	$file = new FileUploader();

$file->upload('image'); 

$file->name()

$file->fullName(); 

$file->type();

$file->status();

$file->statusMessage();