PDA

View Full Version : update uploaded image


ayok
12-23-2007, 09:43 AM
Hi,
I have scripts that are used to update datas from database. So it shows the datas on the browser, change, and update it. But I have problem with updating the image.

Here is my update.php:
<?php
$fupload = $_FILES['fupload']['tmp_name'];
$fupload_name = $_FILES['fupload']['name'];
$category = $_GET['category'];
$title = $_GET['title'];
$descript = $_GET['descript'];
$price = $_GET['price'];
$id = $_GET['id'];
include "../../connection/db.php";

$input=mysql_query("UPDATE products SET title='$title', category='$category', descript='$descript', price='$price', image='$fupload_name' WHERE prod_id='$id'") or die(mysql_error());

$direktori_file = "../../images/products/original/$fupload_name";

if (!move_uploaded_file($fupload, "$direktori_file"))
{
* * echo "Upload failed!<br>";
* * echo "<a href=add_pic.php>Upload again!</a><br>";
}

elseif ($input)
{
* * echo "input data success!<BR>";
* * echo "<a href=add_pic.php>Add again</a><br>";
* * echo "<a href=../logout.php>Logout</a><BR>";
* * echo "<a href=index.php>Cek Products</a><BR>";
}
else
{
* * echo "Input process failed!";
}
.........
?>

With this script, I can update the data's, except the image. Is there anyway i can update the image?

Thank you.
ayok

davidj
01-15-2008, 07:43 AM
sorry i missed this post

did you get it sorted