fopen() and fwrite() not working

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
xplore
Forum Newbie
Posts: 16
Joined: Mon Apr 06, 2009 12:06 pm

fopen() and fwrite() not working

Post by xplore »

So this code used to work but then i re-structured the way it handles to make it easier for accessing the uploads yet it fails.

My root looks like this


index.php
upload.php



no errors occur but the text file 'list.txt' isn't being created, it isn't be written with the filename, and it obviously isn't closing if its not opening.

Code: Select all

 
 
            /* file listing text file for listing off uploads */
            $fileHandle = fopen("uploads/list.txt", 'a');
            $fileName = $_FILES["file"]["name"];
            fwrite($fileHandle, $fileName);
            fclose($fileHandle);
 
divito
Forum Commoner
Posts: 89
Joined: Sun Feb 22, 2009 7:29 am

Re: fopen() and fwrite() not working

Post by divito »

Did the permissions happen to get reset?
xplore
Forum Newbie
Posts: 16
Joined: Mon Apr 06, 2009 12:06 pm

Re: fopen() and fwrite() not working

Post by xplore »

how do I do that ?
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: fopen() and fwrite() not working

Post by McInfo »

What operating system is your server using?

Edit: This post was recovered from search engine cache.
Last edited by McInfo on Mon Jun 14, 2010 2:22 pm, edited 1 time in total.
xplore
Forum Newbie
Posts: 16
Joined: Mon Apr 06, 2009 12:06 pm

Re: fopen() and fwrite() not working

Post by xplore »

This code doesn't even work on my local machine through localhost/
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: fopen() and fwrite() not working

Post by McInfo »

Then you server is localhost. What operating system are you using on localhost? The method for changing permissions is different for different operating systems. Permissions are just one possible cause of the problem, though.

Edit: This post was recovered from search engine cache.
Post Reply