Jump to content

unlink problem


dangeorge6

Recommended Posts

Jeez...half my post got cut for some reason

Here's the error:

Warning: unlink(http://MYURL/Beatles%20-%20It's%20Getting%20Better%20All%20The%20Time.mp3): No such file or directory in /var/www/web2/web/musicproject/php_scripts/functions.php on line 34

 

This link does exist, i've tried it with %20 and just spaces and same error.  Is this a permissions thing?  If so, how can I safely make this work?

Link to comment
https://forums.phpfreaks.com/topic/38397-unlink-problem/#findComment-184135
Share on other sites

My PHP script refused to delete read-only files (which is probably a good thing), but I couldnt find out how to fix this on windows.

 

The solution is simple, i just replaced

<?php @unlink( $entry ); ?>

with:

<?php

               @chmod( $entry, 0777 );

               @unlink( $entry );

?>

 

chmod isnt supposed to work on windows, but 0777 seems to clear the read only flag, and 0444 seems to set the read only flag.

 

 


<?php

$file_to_unlink="delete_me.php";

@chmod( $file_to_unlink, 0777 );

if(@unlink("$file_to_unlink")){

echo "$file_to_unlink deleted";
}else{

echo "sorry but the file $file_to_unlink has not been deleted!";
}

?>

Link to comment
https://forums.phpfreaks.com/topic/38397-unlink-problem/#findComment-184187
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.