cdog5000 Posted August 12, 2008 Share Posted August 12, 2008 what function could i use to make a new file in a directory? Link to comment https://forums.phpfreaks.com/topic/119239-newfile/ Share on other sites More sharing options...
genericnumber1 Posted August 12, 2008 Share Posted August 12, 2008 typically fopen() or file_put_contents() http://us.php.net/manual/en/function.fopen.php http://us3.php.net/file_put_contents Link to comment https://forums.phpfreaks.com/topic/119239-newfile/#findComment-614156 Share on other sites More sharing options...
cdog5000 Posted August 12, 2008 Author Share Posted August 12, 2008 typically fopen() or file_put_contents() http://us.php.net/manual/en/function.fopen.php http://us3.php.net/file_put_contents how would i make it make the file? i get this error trying it... Warning: fopen(./chat/cdog50006.txt) [function.fopen]: failed to open stream: No such file or directory in /home/neweraim/public_html/auth/userRegister.php on line 37 Link to comment https://forums.phpfreaks.com/topic/119239-newfile/#findComment-614159 Share on other sites More sharing options...
DarkWater Posted August 12, 2008 Share Posted August 12, 2008 Show some code. Link to comment https://forums.phpfreaks.com/topic/119239-newfile/#findComment-614167 Share on other sites More sharing options...
cdog5000 Posted August 12, 2008 Author Share Posted August 12, 2008 fopen('./chat/'.$username . '.txt','x+'); Link to comment https://forums.phpfreaks.com/topic/119239-newfile/#findComment-614170 Share on other sites More sharing options...
genericnumber1 Posted August 12, 2008 Share Posted August 12, 2008 if the "chat" dir doesn't already exist it will upset the function... in that case you could use mkdir() to make the dir before creating a file in it. Link to comment https://forums.phpfreaks.com/topic/119239-newfile/#findComment-614175 Share on other sites More sharing options...
cdog5000 Posted August 12, 2008 Author Share Posted August 12, 2008 Warning: fopen(./chat/cdog50006.txt) [function.fopen]: failed to open stream: No such file or directory in /home/neweraim/public_html/auth/userRegister.php on line 37 and fopen('./chat/'.$username . '.txt','x+'); and yes it its a directory Link to comment https://forums.phpfreaks.com/topic/119239-newfile/#findComment-614176 Share on other sites More sharing options...
genericnumber1 Posted August 12, 2008 Share Posted August 12, 2008 Have you created the chat directory at /home/neweraim/public_html/auth/chat/ ? EDIT: nevermind, I didn't see that you said it was already a directory. Try removing the ./ fopen('chat/cdog50006.txt'); or whatever. Link to comment https://forums.phpfreaks.com/topic/119239-newfile/#findComment-614177 Share on other sites More sharing options...
amatz Posted August 12, 2008 Share Posted August 12, 2008 every body can help me?, i am a Beginer of the Php Software... i have a problem about the Odbc connection in Php. how can i connect the Odobc in Php. i have some warning encounter like this "Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'., SQL state 37000 in SQLExecDirect in D:\online_grading\studview1.php on line 8". pls help me godbless to every one!!!.. Link to comment https://forums.phpfreaks.com/topic/119239-newfile/#findComment-614179 Share on other sites More sharing options...
genericnumber1 Posted August 12, 2008 Share Posted August 12, 2008 create your own thread, amatz, this is about cdog's problem. Link to comment https://forums.phpfreaks.com/topic/119239-newfile/#findComment-614180 Share on other sites More sharing options...
cdog5000 Posted August 12, 2008 Author Share Posted August 12, 2008 Warning: fopen(chat/cdog5000900.txt) [function.fopen]: failed to open stream: No such file or directory in /home/neweraim/public_html/auth/userRegister.php on line 37 Link to comment https://forums.phpfreaks.com/topic/119239-newfile/#findComment-614183 Share on other sites More sharing options...
genericnumber1 Posted August 12, 2008 Share Posted August 12, 2008 it shouldn't be giving that error if you have created the chat directory in your auth directory.... try running mkdir('chat'); fopen('chat/cdog5000900.txt'); once. Link to comment https://forums.phpfreaks.com/topic/119239-newfile/#findComment-614185 Share on other sites More sharing options...
cdog5000 Posted August 12, 2008 Author Share Posted August 12, 2008 Warning: mkdir() [function.mkdir]: Permission denied in /home/neweraim/public_html/auth/la.php on line 10 Warning: fopen(chat/cdog5000900.txt) [function.fopen]: failed to open stream: No such file or directory in /home/neweraim/public_html/auth/la.php on line 11 Link to comment https://forums.phpfreaks.com/topic/119239-newfile/#findComment-614201 Share on other sites More sharing options...
genericnumber1 Posted August 12, 2008 Share Posted August 12, 2008 Apparently you don't have permission to create directories, contact your server admin to get such permissions, or if you're the admin, give yourself them . Link to comment https://forums.phpfreaks.com/topic/119239-newfile/#findComment-614213 Share on other sites More sharing options...
cdog5000 Posted August 12, 2008 Author Share Posted August 12, 2008 Apparently you don't have permission to create directories, contact your server admin to get such permissions. i have chmod'd my stuff and it still say's that.... Link to comment https://forums.phpfreaks.com/topic/119239-newfile/#findComment-614214 Share on other sites More sharing options...
genericnumber1 Posted August 12, 2008 Share Posted August 12, 2008 what command did you run? sudo chmod 777? Link to comment https://forums.phpfreaks.com/topic/119239-newfile/#findComment-614225 Share on other sites More sharing options...
cdog5000 Posted August 12, 2008 Author Share Posted August 12, 2008 what command did you run? sudo chmod 777? yes Link to comment https://forums.phpfreaks.com/topic/119239-newfile/#findComment-614226 Share on other sites More sharing options...
genericnumber1 Posted August 12, 2008 Share Posted August 12, 2008 If I trust you that you said you created the chat directory by hand in the proper place, it might cause the access denied error. I have no idea what your problem is, sorry. Try fopen()ing a file (that doesn't exist) in the current directory... eg. remove the /chat/ from the equation, and see if it still says the file does not exist. Link to comment https://forums.phpfreaks.com/topic/119239-newfile/#findComment-614228 Share on other sites More sharing options...
cdog5000 Posted August 12, 2008 Author Share Posted August 12, 2008 If I trust you that you said you created the chat directory by hand in the proper place, it might cause the access denied error. I have no idea what your problem is, sorry. Try fopen()ing a file (that doesn't exist) in the current directory... eg. remove the /chat/ from the equation, and see if it still says the file does not exist. ok... will do Link to comment https://forums.phpfreaks.com/topic/119239-newfile/#findComment-614235 Share on other sites More sharing options...
cdog5000 Posted August 12, 2008 Author Share Posted August 12, 2008 ok... i tried doing: fopen('http://new-era.impsoft.info/auth/la.php','x+'); and it is working atm so i will try this Link to comment https://forums.phpfreaks.com/topic/119239-newfile/#findComment-614242 Share on other sites More sharing options...
cdog5000 Posted August 12, 2008 Author Share Posted August 12, 2008 ok... i tried doing: fopen('http://new-era.impsoft.info/auth/la.php','x+'); and it is working atm so i will try this ok... it is not creating the file.... Link to comment https://forums.phpfreaks.com/topic/119239-newfile/#findComment-614246 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.