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); } Quote 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? Quote 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 (edited) [function.fopen] failed to open stream: No such file or directory in fwrite(): supplied argument is not a valid stream resource in Two errors Edited November 7, 2012 by sungpeng Quote 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 Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.