I solved the problem with uploading an array of files/images, though left unanswered...
But this one I'm way too stumped on. I have a page where you can delete the set of images (imagefile records) you uploaded according to id. The problem is in this process page, my code will delete the records matched with the id, but the set of images don't delete and when I comment out the for and if branches, I get this for an error:
Warning: unlink() failed (Is a directory) in /home/anifact/public_html/admin/submit.php on line 223
Could not delete
Seriously need help or guidance on this one.
<?php
if($command == "deletescreenshots")
{
//refer to particular imagesetID where records for imagefile are being stored
$query = "SELECT * FROM screenshots WHERE ID='$imagesetID'";
$result = mysql_query($query) or die('error making query');
//call upon the array of images that were uploaded into the particular 'imagefile' field
for($i = 0; $_FILES['imagefile']['name'][$i] != ""; $i++){
if ($imagefile == "") {
$i = 500;
}
else {
$original_name = $_FILES['imagefile']['name'][$i];
$size = $_FILES['imagefile']['size'][$i];
$type = $_FILES['imagefile']['type'][$i];
$ii = $i + 1;
$size = $size / 1000;
$size = round($size, 1);
}
unlink ("files/".$original_name) //delete the array of images uploaded into imagefile
or die ("Could not delete");
echo "";
echo "Name: ".$original_name."<br>";
echo "Size: ".$size." KB<br>";
echo "Type: ".$type."<br>";
echo "Image deleted...<p>";
}
$query = "DELETE FROM screenshots WHERE ID='$imagesetID'";
$result = mysql_query($query) or die('error making query');
echo '<a href="index.php">Return to the main page</a>.';
}
?>