Jump to content

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

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.