1. Go to this page and download the library: Download uwdoem/secure-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/ */
uwdoem / secure-upload example snippets
WDOEM\SecureUploads\Cipher;
// Turn on error reporting, but only for troubleshooting and development
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
WDOEM\SecureUploads\Cipher;
// The directory where the encrypted files are
$in = __DIR__ . '/in/';
// The directory that files shall be decrypted to
$out = __DIR__ . '/out/';
// A directory to put encrypted files after they have been decrypted
$processed = __DIR__ . '/processed/';
// The path to your pirvate key
$privateKeyLocation = __DIR__ . '/cert/my_key_name.pem';
// Scan through all of the files in the input directory...
$files = scandir($in);
foreach ($files as $file) {
// If this is a data file...
if (pathinfo($file, PATHINFO_EXTENSION) === 'data') {
// Then identify the hash...
$hash = strtok($file, '.');
// Decrypt the file to the $out directory...
Cipher::decrypt($in . $file, $out, $privateKeyLocation);
// And move all of the encrypted/key/data files for this upload into
// the $processed directory.
foreach (["data", "data.key", "info", "info.key"] as $suffix) {
rename("$in//$hash.$suffix", "$processed//$hash.$suffix");
}
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.