deleting few images from the folder
Posted: Sun Nov 17, 2002 8:52 pm
hello,
i thought i had a perfect upload script, but...
i searched the forum and found no answer.
I have one upload script that allow user to upload up to 4 images for a listing. When the user decide to delete a listing, the listing, the info and all the images will be deleted.
However, my script wont allow me to do that. When i click delete, it only delete the first image & thumb image that the user upload.
here is my delete link:
And here is my delete script:
Like say the user upload 3 images, so there would be 3 original images, and 3 thumb images in the directory, but when i delete the listing, only the first image and the first thumbnail is being deleted, so when i browse the directory, i still see 4 images.
Can somebody tell me what i did wrong in my script
thank you very much
i thought i had a perfect upload script, but...
i searched the forum and found no answer.
I have one upload script that allow user to upload up to 4 images for a listing. When the user decide to delete a listing, the listing, the info and all the images will be deleted.
However, my script wont allow me to do that. When i click delete, it only delete the first image & thumb image that the user upload.
here is my delete link:
Code: Select all
echo "<a href="./mgradmin.php?delete=$a_rowїid]&file_name=$image_rowїfile_name]&thumb_file_name=$image_rowїthumb_file_name]"
onClick="return confirmDelete()">delete listing</a>";Code: Select all
//DELETE A RECORD
if ($delete != "")
{
//delete listing here
$query = "DELETE FROM homes WHERE ((id = '$delete') AND (owner = $current_user))";
if (!mysql_query ($query, $link) )
{
die (mysql_error());
}
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>Listing #$delete has been removed...<br>";
//delete image infomation from the db
$query = "DELETE FROM tbl_thumb WHERE ((prop_num = '$delete') 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 "Images for listing #$delete have also been removed...</b></font>";
Print "</td></tr></table></td></tr></table><br>";
}Can somebody tell me what i did wrong in my script
thank you very much