daxguy Posted August 8, 2010 Share Posted August 8, 2010 I am trying from several hours to sort and issue but i donno what the problem.. this is the following code i am using mkdir("news_upload/$year/$month/$day",0777); touch("news_upload/$year/$month/$day/$title.php"); chmod("news_upload/$year/$month/$day/$title.php",0777); $template = "news_template.php"; $new = "news_upload/$year/$month/$day/$title.php"; copy($template,$new); I have created the directories and given the permission the made a new empty file.. i added permissions to the new made file.. but it didnt apply as i check it.. (PROBLEM) then i have a template designed with the name news_template.php wanted to copy this template to the new created file.. the file gets created.. but the new file is not copying the template file on itself.. have i done anything rong??? help please? Quote Link to comment https://forums.phpfreaks.com/topic/210157-file-copy-problem/ Share on other sites More sharing options...
jcbones Posted August 8, 2010 Share Posted August 8, 2010 Instead of: $template = "news_template.php"; $new = "news_upload/$year/$month/$day/$title.php"; copy($template,$new); Try: $template = file_get_contents("news_template.php"); $new = "news_upload/$year/$month/$day/$title.php"; file_put_contents($new,$template); I suggest this, because a lot of host disable copy for security reasons. Quote Link to comment https://forums.phpfreaks.com/topic/210157-file-copy-problem/#findComment-1096746 Share on other sites More sharing options...
daxguy Posted August 8, 2010 Author Share Posted August 8, 2010 i am still getting the same error message am attaching a screenshot of the error wen i try to access the newly created and used the following code as u said to copy the contents $template = file_get_contents("news_template.php"); $new = "news_upload/$year/$month/$day/$title.php"; file_put_contents($new,$template); here the screen shot [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/210157-file-copy-problem/#findComment-1096765 Share on other sites More sharing options...
jcbones Posted August 9, 2010 Share Posted August 9, 2010 Check the server error log, it will give you the exact reason. If that is not possible, for de-bugging purposes only. Place the following at the top of your script. error_reporting(E_ALL); //over ride error reporting in php.ini ini_set("display_errors", 1); //print errors to screen. Quote Link to comment https://forums.phpfreaks.com/topic/210157-file-copy-problem/#findComment-1096849 Share on other sites More sharing options...
daxguy Posted August 9, 2010 Author Share Posted August 9, 2010 i dont know hot to check the server log.. i did try the code u mentioned for error display error_reporting(E_ALL); //over ride error reporting in php.ini ini_set("display_errors", 1); //print errors to screen. but nothing happened it is still giving the same message as be4.. i have uploaded the error msg image in my previous post! can anyone help? Quote Link to comment https://forums.phpfreaks.com/topic/210157-file-copy-problem/#findComment-1096895 Share on other sites More sharing options...
jcbones Posted August 9, 2010 Share Posted August 9, 2010 Internal server error is an apache error, and the specific problem will be listed in the server log. If you can't find it, contact the host. Quote Link to comment https://forums.phpfreaks.com/topic/210157-file-copy-problem/#findComment-1097185 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.