Gruzin Posted February 13, 2007 Share Posted February 13, 2007 Hi everyone, I have a folder with permission 777 and I can upload files, but I can not delete this files using unlink function... Also I can not change file permission from 600 to 777 or 755. Here is my error: Warning: unlink(../../uploads/) [function.unlink]: Permission denied in /www/cid.ge/doc/admin/functions/eng/delete_image.php on line 11 Thanks for any help, George Quote Link to comment https://forums.phpfreaks.com/topic/38308-unlink-function-not-working-with-permission-600/ Share on other sites More sharing options...
effigy Posted February 13, 2007 Share Posted February 13, 2007 Have you tried using chown after the file has been uploaded to the temporary directory? Quote Link to comment https://forums.phpfreaks.com/topic/38308-unlink-function-not-working-with-permission-600/#findComment-183583 Share on other sites More sharing options...
Gruzin Posted February 13, 2007 Author Share Posted February 13, 2007 Not really... but I've tryed to change it using my ftp client (FlashFXP), doesn't work... Thanks, George Quote Link to comment https://forums.phpfreaks.com/topic/38308-unlink-function-not-working-with-permission-600/#findComment-183586 Share on other sites More sharing options...
trq Posted February 13, 2007 Share Posted February 13, 2007 I've tryed to change it using my ftp client (FlashFXP), doesn't work... You'll need to cnange it via php. Your files will be owned by the same process as apache (usually apache), therefore logging in and trying to change permissions via an ftp client will not work. Quote Link to comment https://forums.phpfreaks.com/topic/38308-unlink-function-not-working-with-permission-600/#findComment-183591 Share on other sites More sharing options...
ToonMariner Posted February 13, 2007 Share Posted February 13, 2007 make sure that open_base_dir is not set in your php configuration - think you have to check safe mode too but can't remember what for Quote Link to comment https://forums.phpfreaks.com/topic/38308-unlink-function-not-working-with-permission-600/#findComment-183592 Share on other sites More sharing options...
Gruzin Posted February 13, 2007 Author Share Posted February 13, 2007 Thanks guys, here is my delete script, I'am trying to change chmod there... is that correct or do I have to change it when I upload the file? <?php require ('../../config.php'); $id = $_GET['del_id']; $sql = mysql_query("SELECT * FROM aid_image WHERE id='$id'"); while($row = mysql_fetch_array($sql)){ $image = $row['image']; } $query = "DELETE FROM aid_image WHERE id='$id'"; $result = mysql_query($query) or die("Error: " . mysql_error()); $file = chmod("../../uploads/".$image, 0777); // remove file from directory unlink($file); header ('Location: eng_dir_image_management.php'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/38308-unlink-function-not-working-with-permission-600/#findComment-183593 Share on other sites More sharing options...
Gruzin Posted February 13, 2007 Author Share Posted February 13, 2007 Ok, I've fixed it, thanks thorpe! Quote Link to comment https://forums.phpfreaks.com/topic/38308-unlink-function-not-working-with-permission-600/#findComment-183594 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.