techiefreak05 Posted December 24, 2006 Share Posted December 24, 2006 why wont this script work ... i cant see why... it has worked before .. it inserts a row into the DB, but it doesnt actualy upload the image, yet it says it does[code]<?php//print_r($_POST);if($_POST["action"] == "-Upload-"){unset($imagename);if(!isset($_FILES) && isset($HTTP_POST_FILES))$_FILES = $HTTP_POST_FILES;if(!isset($_FILES['image_file']))$error["image_file"] = "An image was not found.";$imagename = basename($_FILES['image_file']['name']);//echo $imagename;if(empty($imagename))$error["imagename"] = "The name of the image was not found.";if(empty($error)){$newimage = "files/uploads/" . $_SESSION[username] . "/" . $imagename;mysql_query("INSERT INTO `images` ( `imgPath` , `headline` , `id` , `userid`)VALUES ('http://www.coolhome.phpfora.com/zyco/zycoworld/$newimage', '', '', '$_SESSION[id]');") or die(mysql_error()); echo "<meta http-equiv=\"refresh\" content=\"0;url=imageUpload.php\">";?><font color="red">Image Upload Successful!!</font> <a href="imageUpload.php" class="blue">Refresh Page</a><?php$result = @move_uploaded_file($_FILES['image_file']['tmp_name'], $newimage);if(empty($result))$error["result"] = "There was an error moving the uploaded file.";}}?>[/code] Link to comment https://forums.phpfreaks.com/topic/31756-image-upload-script-not-working/ Share on other sites More sharing options...
JasonLewis Posted December 24, 2006 Share Posted December 24, 2006 remove the @ before the move_uploaded_file because the @ actually prevents errors from displaying. and for checking if it worked do this:[code=php:0]if(!move_uploaded_file($_FILES['image_file']['tmp_name'], $newimage))$error["result"] = "There was an error moving the uploaded file.";}[/code] Link to comment https://forums.phpfreaks.com/topic/31756-image-upload-script-not-working/#findComment-147261 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.