Jump to content

Edit Image


ayok

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/82859-edit-image/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.