Jump to content

deleting image problem


onead

Recommended Posts

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 :)

Link to comment
https://forums.phpfreaks.com/topic/51988-deleting-image-problem/
Share on other sites

$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

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.