Hi
I have this script that reads data and unlinks files.
The directory is set as 755 and all the other directories but the image itself is set at 644 which I would prefer to keep like this but I get the following error.
Is it possible to add a chmod to this script and if so how so that it can delete them.
I have had a few attempts at things like and put them after
while ($current = mysql_fetch_assoc($images)) but none of these worked yet.
chmod('mainimage', 0777);
chmod($current 'mainimage', 0777);
chmod($current['mainimage'], 0777);
Warning: unlink(shopimages/products/normal/BNCTO-40.jpg) [function.unlink]: Permission denied in /var/www/vhosts/test.com/httpdocs/delete_by_id.php on line 32
Code:
$images = mysql_query('SELECT mainimage, thumbnail FROM products WHERE productID IN ('.$data.')') or exit(mysql_error());
while ($current = mysql_fetch_assoc($images))
{
if (trim($current['mainimage']) != '' && is_file($current['mainimage']))
{
unlink($current['mainimage']);
}
if (trim($current['thumbnail']) != '' && is_file($current['thumbnail']))
{
unlink($current['thumbnail']);
}
}
Thanks
Roy