確定這對您的專家來說很簡單,我試圖將圖片上傳到網站並將路徑保存到數據庫。如果可能,如何在保存前更改圖像大小?通過PHP上傳圖片,將圖片路徑保存到MySQL
這裏是我的腳本處理更新時更新查詢:
<?php // Get Event ID
$update=$_GET['update'];
// Create Session
$event_name=$_POST['event_name'];
$event_description=$_POST['event_description'];
$event_date=$_POST['event_date'];
$event_time=$_POST['event_time'];
$event_cost=$_POST['event_cost'];
$event_image=$_POST['event_image'];
// Connection to MySQL Database.
include ('_includes/_dbconnection.php');
include ('_includes/_dbopen.php');
// Update Event using Event ID.
$sql="UPDATE b_events SET ename = '$event_name', edescription = '$event_description', edate = '$event_date', etime = '$event_time', ecost = '$event_cost', eimage = '$event_image' WHERE id = '$update'";
$result=mysql_query($sql);
if($result){
header('Location: _events.php');
}
else {
header('Location: _home.php');
}
?>
我在update.html的圖像下面的代碼:
<input name="event_image" type="file" />
謝謝!
http://stackoverflow.com/a/386581/1220835 – Basti 2012-04-13 07:04:00