SC__Programmer Posted September 2, 2011 Share Posted September 2, 2011 im trying to make a program that changes some files from 0 to 1,but im having some trouble... heres my code, $id = $_GET["id"]; $file1 = "http://mysite.co.cc/users/".$id."/file1.txt"; $fh = fopen($file1, 'w'); fwrite($fh, "1"); fclose($fh); I followed this tut: http://www.tizag.com/phpT/filewrite.php I cant find anything wrong with the code,but it will not make the file have 1 in it. Link to comment https://forums.phpfreaks.com/topic/246314-need-help-with-writing-to-files/ Share on other sites More sharing options...
requinix Posted September 2, 2011 Share Posted September 2, 2011 You cannot write to files over the Internet. If that file is on your website then you have to use the file path for it. $file1 = $_SERVER["DOCUMENT_ROOT"] . "/users/{$id}/file1.txt"; Link to comment https://forums.phpfreaks.com/topic/246314-need-help-with-writing-to-files/#findComment-1264940 Share on other sites More sharing options...
SC__Programmer Posted September 3, 2011 Author Share Posted September 3, 2011 thanks! Link to comment https://forums.phpfreaks.com/topic/246314-need-help-with-writing-to-files/#findComment-1264951 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.