Image deleting problem...
Posted: Sun May 30, 2004 11:00 am
I have a small problem with deleting an image. I have a small image gallery kinda thing in my webpage where users can upload images. Well, i now need a function to delete image. Details are passed via url to deleting script, which then deletes the references to current image from database and when deleting from db is successful i want it to delete that image from it's folder. I got messed up with those permeission things...
I run the script now on my home server (localhost) and will soon upload it to my web server.
URL vars:
After deleting from DB, this:
Those chmod things dosn't seem to work... have no idea of them anyway
I always get this error:
Warning: unlink() failed (Permission denied) in F:\FOX\www\res\delpic.php on line 55
How to do this properly? Thanks for any help.
I run the script now on my home server (localhost) and will soon upload it to my web server.
URL vars:
Code: Select all
<?php
delpic.php?id=4&cat=sra&file=img001.jpg
?>Code: Select all
<?php
$root = "F:/FOX/www/res/pics/";
$dir = $_GET['cat']."/";
$file = $_GET['name'];
chmod($root.$dir, 0777);
chmod($root.$dir.$file, 0777);
unlink($root.$dir.$file);
?>I always get this error:
Warning: unlink() failed (Permission denied) in F:\FOX\www\res\delpic.php on line 55
How to do this properly? Thanks for any help.