laide234 Posted August 10, 2006 Share Posted August 10, 2006 I think my code is fine. But the images arent even getting to the server. Please take a look at my function:function modifyProduct(){ $path = $_SERVER['DOCUMENT_ROOT']; $dirname = '/images/product/'; $chmod = 0755; // create file vars to make things easier to read. $filename = $_FILES['fleImage']['name']; $filesize = $_FILES['fleImage']['size']; $filetype = $_FILES['fleImage']['type']; $file_tmp = $_FILES['fleImage']['tmp_name']; $file_err = $_FILES['fleImage']['error']; $file_ext = strrchr($filename, '.'); $productId = (int)$_GET['productId']; $catId = $_POST['cboCategory']; $name = $_POST['txtName']; $description = $_POST['mtxDescription']; $price = str_replace(',', '', $_POST['txtPrice']); $qty = $_POST['txtQty']; $scost = str_replace(',', '', $_POST['txtScost']); $ropoint = $_POST['txtRop']; $dir = $path . $dirname; $prefix = substr($filename, 0, -4); $thumb = "_t"; $thumbnail = $prefix . $thumb . $file_ext; // if uploading a new image (filename field is not empty) // remove old image if ($filename != '') { _deleteImage($productId); if (@move_uploaded_file($file_tmp, $dir . '/' . $filename)) { $n_w = 240; $n_h = 240; $t_w = 75; $t_h = 75; $o_path = " "; $s_path = " "; Resize_Image($dir . '/' . $thumbnail,$dir . '/' . $filename,$t_w,$t_h,$s_path,$o_path); Resize_Image($dir . '/' . $filename,$dir . '/' . $filename,$n_w,$n_h,$s_path,$o_path); $filename = "'$filename'"; $thumbnail = "'$thumbnail'"; } else { // error moving file. check file permissions. unlink($file_tmp); echo '<strong>Error:</strong> Unable to move file to designated directory.'; } } else { // if we're not updating the image // make sure the old path remain the same // in the database $filename = 'pd_image'; $thumbnail = 'pd_thumbnail'; } $sql = "UPDATE tbl_product SET cat_id = $catId, pd_name = '$name', pd_description = '$description', pd_price = $price, pd_qty = $qty, pd_image = $filename, pd_thumbnail = $thumbnail, pd_scost = $scost, pd_ropoint = $ropoint WHERE pd_id = $productId"; $result = dbQuery($sql); header('Location: index.php'); } Quote Link to comment Share on other sites More sharing options...
AndyB Posted August 10, 2006 Share Posted August 10, 2006 Try removing the @ error suppression from your code. Ensure that $dir has appropriate permissions. Echo the full value of $dir and $thumbnail to see if they are 'correct' values. Quote Link to comment Share on other sites More sharing options...
laide234 Posted August 11, 2006 Author Share Posted August 11, 2006 you are absolutely right!! it was the path. I had switched directories and forgot to update$dirname = '/images/product/'; Quote Link to comment 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.