The Little Guy Posted September 29, 2009 Share Posted September 29, 2009 I can't for some reason delete a file!!! Warning: unlink(C:\php_files\tmp\get79C.tmp): Permission denied in C:\php_files\id3.php on line 66 I don't know how to grant myself permission to use that folder. $remotefilename = $row['url']; $localtempfilename = tempnam('C:\php_files\tmp', 'getID3'); $main = fopen($localtempfilename, 'wb'); $handle = fopen($remotefilename, "rb"); $contents = stream_get_contents($handle); fclose($handle); fwrite($main, $contents); // do some stuff to the file unlink($localtempfilename); Another think I should mention, is that I am running PHP through cmd, not a web browser... Thanks for your help! Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 29, 2009 Share Posted September 29, 2009 <?php unlink($localtempfilename,0777); ?> Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 29, 2009 Share Posted September 29, 2009 Even more powerful. <?php @chmod( $entry, 0777 ); @unlink( $entry ); ?> Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 29, 2009 Share Posted September 29, 2009 try it directly in cmd like <?php if (file_exists('folder/file.php')) { unlink('folder/file.php'); } ?> Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted September 29, 2009 Author Share Posted September 29, 2009 Even more powerful. <?php @chmod( $entry, 0777 ); @unlink( $entry ); ?> Permission is still denied Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 29, 2009 Share Posted September 29, 2009 Got to be file permission man? set windows folder/file permissions http://www.microsoft.com/windowsxp/using/networking/security/permissions.mspx Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted September 29, 2009 Author Share Posted September 29, 2009 OMG! I got it I forgot to close the file fclose. It was still open for writing. Thanks for the help though Quote Link to comment 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.