ayok Posted December 23, 2007 Share Posted December 23, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/82859-edit-image/ Share on other sites More sharing options...
Barand Posted December 23, 2007 Share Posted December 23, 2007 try changing your form method to POST and make sure you have "enctype='multipart/form-data'" in your form tag. Quote Link to comment https://forums.phpfreaks.com/topic/82859-edit-image/#findComment-421445 Share on other sites More sharing options...
ayok Posted December 23, 2007 Author Share Posted December 23, 2007 Hi Barand, No.. with $_GET, the table is updated (except the image -> becomes blank), with $_POST nothing's happened. What doesn't work is the image isnot uploaded. And I have "enctype='multipart/form-data'" in the form tag. perhaps I need to change $_file? Thanks, ayok Quote Link to comment https://forums.phpfreaks.com/topic/82859-edit-image/#findComment-421630 Share on other sites More sharing options...
ayok Posted December 23, 2007 Author Share Posted December 23, 2007 anyone? Quote Link to comment https://forums.phpfreaks.com/topic/82859-edit-image/#findComment-421665 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.