techiefreak05 Posted December 20, 2006 Share Posted December 20, 2006 When people register on my webite, a folder is created in their name and i have them create and edit files .. kinda like freewebs.com .. but i cant figure out how to create files... heres what i have..<?phpfopen($_SESSION[username] . "/" . $_POST[name], "w+");?> Why doesnt that work? Quote Link to comment https://forums.phpfreaks.com/topic/31299-fopen-help/ Share on other sites More sharing options...
HuggieBear Posted December 20, 2006 Share Posted December 20, 2006 You need to use fopen() in conjunction with fwrite().My advice would be to join the path first, not in the function, so like this:[code]<?php$file = $_SESSION['username'] . "/" . $_POST['name'];if ($fh = fopen($file, "w"){ fwrite($fh, "This is test text\n");}else { echo "Couldn't create file\n";}?>[/code]RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/31299-fopen-help/#findComment-144844 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.