p595285902 Posted February 24, 2012 Share Posted February 24, 2012 Under localhost, the files will be created when I "submit". But it is not working on website when I upload everything.Do I need to download anything into web server or some "magic" stuff I should put on web server from localhost?I am beginner, so I probably missing something.Is it the permission thing that is stopping from user? process.php file <?php$url=$_POST['url'];$wrong=$_POST['wrong'];$correct=$_POST['correct'];$name=$_POST['name'];$data=$url."\r\n".$wrong."\r\n".$correct."\r\n".$name."\r\n"."\r\n";file_put_contents("data/$name.txt", $data, FILE_APPEND);?> form file with <form method="POST" action="process.php">Website url: <textarea rows="1" cols="80" type="text" name="url">url</textarea><br/><!-- if you want a HUGE text area, use <textarea name="myInputName"></textarea> instead -->The wrong sentence: <textarea rows="2" cols="80" type="text" value="wrong sentence" name="wrong"/> Please type in the wrong sentence</textarea><br/>The correct sentence: <textarea rows="2" cols="80" type="text" value="correct sentence" name="correct"/> Please type in the correct sentence</textarea><br/>Your name: <input type="text" value="your name is needed" name="name"/><br/><input type="submit" name"submitButton" value="Submit!" /><br/></form> Link to comment Share on other sites More sharing options...
justsomeguy Posted February 24, 2012 Share Posted February 24, 2012 That will fail if PHP doesn't have permission to write to that directory, or if the filename contains invalid characters. Link to comment Share on other sites More sharing options...
p595285902 Posted February 24, 2012 Author Share Posted February 24, 2012 How can I set the permission for it?Or is there a way to let user to store the input into Web Server? Link to comment Share on other sites More sharing options...
[dx] Posted February 24, 2012 Share Posted February 24, 2012 Go to your server with your ftp client, and choose folder you want change permision, right click, and select cdmod. Link to comment Share on other sites More sharing options...
birbal Posted February 24, 2012 Share Posted February 24, 2012 and also you can change it from your cpanel if your host provide it. There is file permission beside the file name in your cpanel file explorer. Link to comment Share on other sites More sharing options...
thescientist Posted February 24, 2012 Share Posted February 24, 2012 you can also change the permissions in your script using chmod before writing to the file. Basic error handling in this case is a must so you can alert yourself or the user if there were any issues. Link to comment Share on other sites More sharing options...
p595285902 Posted February 25, 2012 Author Share Posted February 25, 2012 Thanks guys, problem solved ;D Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.