onead Posted May 18, 2007 Share Posted May 18, 2007 Hi I am having problems deleting an image from a cms i have developed. The function was originally developed and hosted on a 1&1 server and the function worked correctly and deleted the image as i wanted but now i have transferred the site to a godaddy server and the delete function will not work. I just get the following error: Warning: unlink(../gallery/staffimages/staff_.jpg): No such file or directory in /home/content/o/a/k/oakleasing/html/test/admin/include/functions.php on line 11 Warning: Cannot modify header information - headers already sent by (output started at /home/content/o/a/k/oakleasing/html/test/admin/include/functions.php:11) in /home/content/o/a/k/oakleasing/html/test/admin/index.php on line 74 this is the function that takes care of the delete part and gives the first warning: function deleteStaffGalleryFile($id) { $id = sqlInjectionProtect($id); $filename = "staff_$id.jpg"; $path = "../gallery/staffimages/$filename"; unlink($path); } and this is the part fo the index file that produces the second warning case "deletestaff": // Delete the image from the server. $deletestaffmagefile = deleteStaffGalleryFile($id); // Delete the image from the database. $deletestaff = deleteStaff($id); // Return to the last viewed vehicle. header("Location: index.php?sub=staff"); break; I would be very grateful if anyone can help on this as i have been pulling my hair out ofr a few days trying to get it working many thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/51988-deleting-image-problem/ Share on other sites More sharing options...
jitesh Posted May 18, 2007 Share Posted May 18, 2007 $filename = "staff_$id.jpg"; // There is prb with shown as bold --- staff_$id.jpg $path = "../gallery/staffimages/$filename"; unlink(../gallery/staffimages/staff_[Id is not available here].jpg): No such file or directory in /home/content/o/a/k/oakleasing/html/test/admin/include/functions.php Quote Link to comment https://forums.phpfreaks.com/topic/51988-deleting-image-problem/#findComment-256265 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.