Forum Moderators: coopster

Message Too Old, No Replies

Unlink() problem

Unable to locate stream wrapper -?

         

McRib

3:43 pm on Apr 12, 2008 (gmt 0)

10+ Year Member



Hi,
I've got a simple line of code that deletes an image:

if( !unlink( $image ) ) {
die( 'Could not delete the image file.' );
}

However I'm getting the following error:

Warning: unlink() [function.unlink]: Unable to locate stream wrapper in ***/wallpaper-existing/index.php on line 80

I'm using the correct full path to the image, so perhaps this issue is related to permissions? Currently the owner of the image file is the FTP user.

Any help would be appreciated :)

coopster

9:02 pm on Apr 12, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, McRib.

I'm not so certain you are even getting to the permissions part of this operation as the message seems to be stating an issue in regards to the stream wrapper [php.net].

What is in the value of $image?

print '<pre>'; var_dump($image); print '</pre>'; exit; 
if( !unlink( $image ) ) {
die( 'Could not delete the image file.' );
}

McRib

7:47 pm on Apr 14, 2008 (gmt 0)

10+ Year Member



Thanks for the link to that page Coopster, after reading through that page I realised I had an error in my path to the file.