PHP code example of marcodattisi / composer-upload

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

    

marcodattisi / composer-upload example snippets



eazione di istanze e definizione della posizione della cartella di caricamento del file
$file = new MarcoUpload\MarcoUpload(__DIR__ );

$percorso = $file->upload($_FILES['archivio'], [
	'move' => '/uploaded/',                 // Cartella di destinazione
	'size' => 2000000,                      // Grandezza file esempio 2MB
	'type' => ['jpg', 'png']                // Estensioni accettate.
]);
//Controllo errori
if(!$file->getErros()){
	//Percorso del file nel server rinominato
	echo $percorso;
} else {
	var_export($file->getErros());
}