xcandiottix Posted June 12, 2010 Share Posted June 12, 2010 I've just inserted some code to make a directory, a index.html file, and a user.xml file. After I run the code I get "success." I check the file browser online and my file and directory exist, I can open and view the files. I switch to dreamweaver and check remote view and the files exist; I download them and they are all proper. Then I try typing in http://..location of file... and I get a 404. What am i missing? Do I need to declare file permissions when I create the directory & files? $username = $row['db_Username']; //make user directory $userdirectory = "/html/users/".$username.""; mkdir($userdirectory, 0700); //make user index file $create = "/html/users/".$username."/index.html"; $handler = fopen($create, 'w') or die("Error: Set up has encountered an error. Please try again."); $string = "<html>Forward to member launch pad with user name</html>"; fwrite($handler, $string); fclose($handler); //make user XML $create = "/html/users/".$username."/".$username.".xml"; $handler = fopen($create, 'w') or die("Error: Set up has encountered an error. Please try again."); $string = "XML data"; fwrite($handler, $string); fclose($handler); echo "<br>"; echo '<a href="http://www.site.com/users/'.$username.'">http://www.site.com/users/'.$username.'/'; mysql_close($con); http://www.site.com/users/username/index.html = 404 Link to comment https://forums.phpfreaks.com/topic/204605-fopen-file-exists-but-server-reports-error/ Share on other sites More sharing options...
xcandiottix Posted June 12, 2010 Author Share Posted June 12, 2010 If you have godaddy and ran into the same problem add: chmod($userdirectory, 0755); after //make user directory $userdirectory = "/home/content/q/1/w/q1w2e3r4t5y6u7/html/users/".$username.""; mkdir($userdirectory, 0700); ---here--- For why this works: http://php.net/manual/en/function.chmod.php Link to comment https://forums.phpfreaks.com/topic/204605-fopen-file-exists-but-server-reports-error/#findComment-1071293 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.