peter_anderson Posted December 29, 2011 Share Posted December 29, 2011 I am trying to delete a file via unlink(). It's a .html file, stored in a folder on its own. // current directory $dir = dirname(__FILE__); $dir = str_replace('classes','',$dir); $file = str_replace('./',$dir,$fr['location']); unlink($fr['location']); if(!unlink($file)){ echo 'err'; } if(file_exists($file)){ echo 'ok1'; } The $fr['location'] stores the real location, as ./uploads/1303577497/barebones.html. I've tried every combination I can think of to delete it. I've even deleted it from FTP and re-uploaded it, in case it was a permissions issue, but it refuses to go. When I file_get_contents it, it appears as existing. Can anyone help? Quote Link to comment https://forums.phpfreaks.com/topic/254031-unlink-refusing-to-delete-file/ Share on other sites More sharing options...
peter_anderson Posted December 29, 2011 Author Share Posted December 29, 2011 OK, I fixed it by setting up the permissions for the folder to 777. Quote Link to comment https://forums.phpfreaks.com/topic/254031-unlink-refusing-to-delete-file/#findComment-1302281 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.