quick problem with unlink solved

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
scarface222
Forum Contributor
Posts: 354
Joined: Thu Mar 26, 2009 8:16 pm

quick problem with unlink solved

Post by scarface222 »

Hey guys this script does not work. Anyone have an idea of what I did wrong?

Code: Select all

$myFile = "usercontent/$user/audio";
$fh = fopen($myFile, 'w') or die("can't open file");
$myFile = "usercontent/$user/audio/$mp3";
unlink($myFile);
fclose($fh);
Last edited by scarface222 on Tue Oct 13, 2009 9:02 pm, edited 1 time in total.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: quick problem with unlink

Post by requinix »

scarface222 wrote:Anyone have an idea of what I did wrong?
Yep: you assumed we knew exactly what this code is all about, knew exactly what the variables were and what values they had, and could easily identify any possible problem that may exist.

Give a description. Background on the project. Details of the error. Error messages if you have any.
scarface222
Forum Contributor
Posts: 354
Joined: Thu Mar 26, 2009 8:16 pm

Re: quick problem with unlink

Post by scarface222 »

there is a file ($mp3) I need deleted within a folder ($user=g) within a folder (audio). I wanted to know if my form for my unlink script was correct. As in did I take the right steps to get to the file I want and delete it. Sorry I was in a rush and worded the question poorly.

this is the error I have now that I have tested it properly
Warning: fopen(usercontent/g/audio) [function.fopen]: failed to open stream: Permission denied in C:\Web Files\wamp\www\y\testing123.php on line 13
can't open file
scarface222
Forum Contributor
Posts: 354
Joined: Thu Mar 26, 2009 8:16 pm

Re: quick problem with unlink solved

Post by scarface222 »

solved it myself i needed to change the folder access to 666.
Post Reply