swissbeets Posted July 19, 2008 Share Posted July 19, 2008 i have a back end part to my site so someone can easily update the products. i want it to be able to save pictures from my desktop in my website images folder ithought it worked but it definitely doesnt i am pretty sure its because the images arent saving right here is my code i took it from a tutorial and based it to needs <?php require_once("includes/session.php"); ?> <?php require_once("includes/connection.php"); ?> <?php require_once("includes/functions.php"); ?> <?php confirm_logged_in(); //echo "<pre>"; //print_r($_FILES); //echo "</pre>"; $target_path = "images\ ".$_FILES['uploadedfile']['name']; move_uploaded_file($_FILES['uploadedfile']['tmp_name'],$target_path); $image_source = mysql_prep($_FILES['uploadedfile']['name']); $id = $_GET['prod']; $query = "UPDATE products SET image_source = '$image_source' WHERE product_id = $id"; //print $query; $result = mysql_query($query); if (mysql_affected_rows() == 1) { redirect_to("edit_product.php"); } else { // Failed $message = "The product update failed."; $message .= "<br />". mysql_error(); }?> does anyone see anything i am doing wrong? Quote Link to comment https://forums.phpfreaks.com/topic/115632-solved-file-uploading/ Share on other sites More sharing options...
marklarah Posted July 19, 2008 Share Posted July 19, 2008 "Aren't saving right" what are they pictures of mickey mouse when you uploaded donald duck? Are they just not there? Have they moved folder? Be specific. DO you have the include pages? Also, if its a tutorial, then it 99% works. Make sure you did everything exact. If it still doesn't work, then its a problem with th tutorial code. Contact the author of it if its a genuine problem. Upon reading your code...what the hell??? this has nothing to with image UPLOADING....please rephrase your question. Quote Link to comment https://forums.phpfreaks.com/topic/115632-solved-file-uploading/#findComment-594442 Share on other sites More sharing options...
swissbeets Posted July 19, 2008 Author Share Posted July 19, 2008 i kind of assumed that "$target_path = "images/ ".$_FILES['uploadedfile']['name']; move_uploaded_file($_FILES['uploadedfile']['tmp_name'],$target_path); $image_source = mysql_prep($_FILES['uploadedfile']['name']); " was moving a file, is it not? my code (i thought) was saving the file in my images folder and then saving the name in my database is that not what this is doing with the uploader? if not what is it doing? Quote Link to comment https://forums.phpfreaks.com/topic/115632-solved-file-uploading/#findComment-594445 Share on other sites More sharing options...
swissbeets Posted July 19, 2008 Author Share Posted July 19, 2008 dumb mistake, the "images/" was wrong i knew it was something small again eventhough it had been working before thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/115632-solved-file-uploading/#findComment-594446 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.