PHP code example of vitoria / upload

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

    

vitoria / upload example snippets




//load input [HTML]
//Carrega o valor da variavel HTML
$loadfile = $_FILES['loadfile'];

//Default Dir: public/upload-file/
//Pasta padrao: public/upload-file/
//$dirFile = "public/upload-file/";
$dirFile = "public/upload-file/";

//set namespace;
//Define os namespaces
use src\modular\core\Upload,
    src\modular\core\method\MethodUpload;

//call Class
//Instanciar as classes
$methodUp = new MethodUpload();
$render = new  Upload($methodUp);

//Define MIMI Type
//Default MIMI: ['image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'audio/mp3']
//Define as extensões
//Por padrão, o mimi é:['image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'audio/mp3']

$mimi = ['image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'audio/mp3'];

//set file MIMI
//Carrega as extensoes
$methodUp->setFileType($mimi );

//set variable or value of input [HTML]
//carrega a(s) variavel (is) vinda(s) do Formulario HTML
$methodUp->setLoadfiles($loadfile);

//set Dir - Optional
//Define a pasta para os arquivos - Opcional
$methodUp->setDirFiles($dirFile);

//load files
//Carrega os arquivos
$render->render();