1. Go to this page and download the library: Download initphp/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/ */
initphp / upload example snippets
use InitPHP\Upload\Upload;
use InitPHP\Upload\File;
$credentials = [
'dir' => __DIR__ . '/uploads/',
'url' => 'https://example.com/uploads/',
];
$options = [
'allowed_extensions' => [],
'allowed_mime_types' => [],
'allowed_max_size' => 0,
];
$adapter = new InitPHP\Upload\Adapters\LocalAdapter($credentials, $options);
$upload = new Upload($adapter);
foreach (File::setPost('files') as $file) {
$upload->setFile($file)
->to();
}