cursed Posted August 3, 2009 Share Posted August 3, 2009 <?php include 'config.php'; $item = $_GET['web']; $file = "/ips/$ip$magic.txt"; $Handle = fopen($file, 'a'); fwrite($Handle, "$item\n\r"); echo "Data Written, $ip"; fclose($Handle); ?> So in this line: file = "/ips/$ip$magic.txt"; If I take out /ips/ it works fine. I have created the /ips/ folder and chmodded it to 777. Any help would be greatly appreciated. Sorry for the newbie question. Edit: Error info: Warning: fopen(/ips/65.49.14.10158.txt) [function.fopen]: failed to open stream: No such file or directory in /home7/ahotbeve/public_html/ipodtouchmaster/testqq/lol/filewritetest.php on line 5 Warning: fwrite(): supplied argument is not a valid stream resource in /home7/public_html/filewritetest.php on line 6 Data Written, (my ip) Warning: fclose(): supplied argument is not a valid stream resource in /home7/public_html//filewritetest.php on line 8 Link to comment https://forums.phpfreaks.com/topic/168583-solved-write-to-folderfile-doesnt-work-but-writing-to-file-works/ Share on other sites More sharing options...
.josh Posted August 3, 2009 Share Posted August 3, 2009 is your path correct? That / on the front of the path makes it look for the ips directory, starting in the root public directory. public_html/ips/$ip$magic.txt Is that where the file really is? Link to comment https://forums.phpfreaks.com/topic/168583-solved-write-to-folderfile-doesnt-work-but-writing-to-file-works/#findComment-889233 Share on other sites More sharing options...
cursed Posted August 3, 2009 Author Share Posted August 3, 2009 Aha, thank you, it works perfectly. Time to take over the world with this code... Sorry again for the newb question. Link to comment https://forums.phpfreaks.com/topic/168583-solved-write-to-folderfile-doesnt-work-but-writing-to-file-works/#findComment-889234 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.