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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.