sungpeng Posted November 7, 2012 Share Posted November 7, 2012 $file = "$uid.php"; $open = fopen($file, "w"); fwrite($open, $content); fclose($open); } The above code is working fine. If I am putting it in the folder, how should i code ? Like the below which generate error message. $file = "/page/$uid.php"; $open = fopen($file, "w"); fwrite($open, $content); fclose($open); } Link to comment https://forums.phpfreaks.com/topic/270402-putting-fopen-variable-into-folder/ Share on other sites More sharing options...
trq Posted November 7, 2012 Share Posted November 7, 2012 What is the error? Link to comment https://forums.phpfreaks.com/topic/270402-putting-fopen-variable-into-folder/#findComment-1390744 Share on other sites More sharing options...
sungpeng Posted November 7, 2012 Author Share Posted November 7, 2012 [function.fopen] failed to open stream: No such file or directory in fwrite(): supplied argument is not a valid stream resource in Two errors Link to comment https://forums.phpfreaks.com/topic/270402-putting-fopen-variable-into-folder/#findComment-1390747 Share on other sites More sharing options...
sungpeng Posted November 7, 2012 Author Share Posted November 7, 2012 My am creating a new page by itself and is named as a variable $uid.php Link to comment https://forums.phpfreaks.com/topic/270402-putting-fopen-variable-into-folder/#findComment-1390748 Share on other sites More sharing options...
trq Posted November 7, 2012 Share Posted November 7, 2012 The path your are supplying fopen doesn't exist. Are you sure it should be /page ? / Indicates the root of the filesystem. Link to comment https://forums.phpfreaks.com/topic/270402-putting-fopen-variable-into-folder/#findComment-1390762 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.