Jump to content

fopen() not working?


rockinaway

Recommended Posts

if ($fp = @fopen('folder/file.php', "w"))
                        {
                                // Write the data to the file
                                fwrite($fp, $data);

                                // Close the file
                                fclose($fp);
                        }
                        else echo $_POST['content'];

 

My script won't open the file and write the content.. the $data is declared.. is there something I am missing?

Link to comment
https://forums.phpfreaks.com/topic/68582-fopen-not-working/
Share on other sites

Well, it would be nice if you told us what does happen when you try this code.

 

However, im going to assume that nothing happens - ie, you get no error messages, but there is no writing to the file.

 

If you are having problems with a script, it's generally a good idea to remove the error suppresion(@). Try changing this line:

 

if ($fp = @fopen('folder/file.php', "w"))

 

To:

 

if ($fp = fopen('folder/file.php', "w"))

 

Post the error message if you get one.

Link to comment
https://forums.phpfreaks.com/topic/68582-fopen-not-working/#findComment-344761
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.