<!DOCTYPE html>
<html lang="az">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Fayl Y�kl?m? <title>Fayl Y�kl?m?</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 50px;
}
.container {
max-width: 500px;
margin: auto;
padding: 20px;
border: 1px solid #ddd;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
input[type="file"] {
width: calc(100% - 20px);
padding: 10px;
margin: 10px 0;
border: 1px solid #ddd;
border-radius: 4px;
}
input[type="submit"] {
padding: 10px 20px;
background-color: #007BFF;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #0056b3;
}
.result {
margin-top: 20px;
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
background-color: #f9f9f9;
}
</style>
<div class="container">
Fayl Y�kl?m? Formasi
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$upload_dir = "uploads/"; // Fayllarin y�kl?n?c?yi qovluq
// Fayl m?lumatlarini ?ld? et
$file_tmp_path = $_FILES["file"]["tmp_name"];
$file_name = basename($_FILES["file"]["name"]);
$file_path = $upload_dir . $file_name;
// Qovlugun m�vcudlugunu yoxla v? yaradilmadigi halda yaradin
if (!file_exists($upload_dir)) {
mkdir($upload_dir, 0777, true);
}
// Fayli y�kl?
if (move_uploaded_file($file_tmp_path, $file_path)) {
echo "<div class='result'>Fayl ugurla y�kl?ndi: " . htmlspecialchars($file_name) . "</div>";
} else {
echo "<div class='result'>Fayl y�kl?n?rk?n x?ta bas verdi.</div>";
}
}
</div>