1. Go to this page and download the library: Download vista-php/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/ */
vista-php / upload example snippets
use Vista\Upload\FileUploader;
$uploader = new FileUploader('file');
$uploader->upload();
use Vista\Upload\FileUploader;
$uploader = new FileUploader('file');
$uploader->setAllowedMimeTypes(['image/jpeg', 'image/png', 'image/gif'])
->setMaxFileSize(1024 * 1024); // 1MB
->setUploadDirectory(__DIR__ . '/uploads') // It should be a writable directory
->setAllowOverwrite(true) // default is false
->setFileName('file')
->setFileNamePrefix('prefix_')
->setFileNameSuffix('_suffix.jpg');
$uploader->upload();
$validation = $uploader->validate(); // true or false
use Vista\Upload\FileUploader;
$uploader = new FileUploader();
$success = $uploader->delete(__DIR__ '/path/to/file.jpg'); // returns true or false
bash
composer
file.txt
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.