1. Go to this page and download the library: Download reich/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/ */
$upload->encryptFileNames(true)->only(['jpg']); // only jpg files will be encrypted
$upload->encryptFileNames(true)->only('jpg|png|txt'); // only jpg, png and txt files will be encrypted
$upload->start();
$upload->success(function($file) {
// handle the file
});
$upload->error(function($file) {
// handle the file
});
if($upload->unsuccessfulFilesHas())
{
// display all errors with bootstraps
$upload->displayErrors();
// now of course you may formating it differently like so
foreach($upload->errorFiles as $file)
{
// do whatever you want with the file object
// - $file->name
// - $file->encryptedName *only if you asked to encrypt*
// - $file->type
// - $file->extension
// - $file->size
// - $file->error
// - $file->errorMessage
}
}
else if($upload->successfulFilesHas())
{
$upload->displaySuccess();
// now of course you may formating it differently like so
foreach($upload->successFiles as $file)
{
// do whatever you want with the file object
// - $file->name
// - $file->encryptedName *only if you asked to encrypt*
// - $file->type
// - $file->extension
// - $file->size
}
}
print_r($upload->debug()); // There are some errors only you should look at while setting this up
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.