pneudralics Posted April 21, 2009 Share Posted April 21, 2009 $ourFileName = "testFile.txt"; $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); fclose($ourFileHandle); The above code creates the file but how to I specify where the file goes? Link to comment https://forums.phpfreaks.com/topic/154964-solved-how-can-i-create-a-file-in-a-specific-directory/ Share on other sites More sharing options...
steveangelis Posted April 21, 2009 Share Posted April 21, 2009 $ourFileName = "testFile.txt"; $ourFileHandle = fopen('directory'.$ourFileName, 'w') or die("can't open file"); fclose($ourFileHandle); Try that. Link to comment https://forums.phpfreaks.com/topic/154964-solved-how-can-i-create-a-file-in-a-specific-directory/#findComment-815117 Share on other sites More sharing options...
taith Posted April 21, 2009 Share Posted April 21, 2009 $ourFileName = "directory/testFile.txt"; $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); fclose($ourFileHandle); Link to comment https://forums.phpfreaks.com/topic/154964-solved-how-can-i-create-a-file-in-a-specific-directory/#findComment-815119 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.