unlink () question, unable to delete thumbnail picture
Posted: Sat Nov 16, 2002 5:03 pm
hello,
after when i have this problem solved, i will have a complete upload script.
I have a script that upload image to the directory, image info to the database. Everything works just fine until when i tried to delete an image.
When i click delete, the image info is deleted from the database, the original image is deleted from the directory, but the image thumbnail is unable to delete.
this is my delete image script:
and i get this error message:
and line 312 is :
when i browse the directory with FTP, i notice that the original image is removed, but the thumb is still there.
I would like to find out what went wrong there? what do i have to check in order to get this right?
thank you very much
after when i have this problem solved, i will have a complete upload script.
I have a script that upload image to the directory, image info to the database. Everything works just fine until when i tried to delete an image.
When i click delete, the image info is deleted from the database, the original image is deleted from the directory, but the image thumbnail is unable to delete.
this is my delete image script:
Code: Select all
//DELETE AN IMAGE
if ($deleteimage != "")
{
$query = "DELETE FROM tbl_thumb WHERE ((ID = $deleteimage) AND (owner='$current_user'))";
if (!mysql_query ($query, $link) ){die (mysql_error());}
unlink("$listings_upload_path/$file_name");
unlink("$listings_upload_path/$thumb_file_name");
Print "<table cellspacing=5 cellpadding=5 width=100%><tr><td>";
print "<table border=0 cellspacing=0 cellpadding=5 width=100%><tr><td height=28>";
print "<font face="Verdana" size=2><b>$file_name and thumb image have been successfully removed.</b></font>";
print "</td></tr></table>";
Print "</td></tr></table><br><br>";
}Code: Select all
Warning: unlink() failed (Is a directory) in /home/virtual/site58/fst/var/www/html/test/upload.php on line 312Code: Select all
unlink("$listings_upload_path/$thumb_file_name");I would like to find out what went wrong there? what do i have to check in order to get this right?
thank you very much