daxguy Posted August 8, 2010 Share Posted August 8, 2010 I have written a piece of code that create a directories, files on the server using mkdir and touch and also inserts the form data into the table.. the code gets executed and the info gets stored in the database but the part which has the create directories. and files dont work as it doesnt create the directory and files on the server.. do i need to make changes to the php.ini file to enable the mkdir and touch feature to get enabled? as i said the code executes without any error.. I dont know wat to do.. please any help would be appreciated!! thanku Quote Link to comment Share on other sites More sharing options...
daxguy Posted August 8, 2010 Author Share Posted August 8, 2010 anyone who can help? Quote Link to comment Share on other sites More sharing options...
TOA Posted August 8, 2010 Share Posted August 8, 2010 Post the code and we'll do our best Quote Link to comment Share on other sites More sharing options...
daxguy Posted August 8, 2010 Author Share Posted August 8, 2010 i tried adding file permission to the folder on which the directories and the files were being created.. and it worked 1ce and i dunno wats up with it.. it aint working again the code is $title = $_POST['title']; if(is_dir("news_upload")) { if(is_dir("news_upload/$year")) { if(is_dir("news_upload/$year/$month")) { if(is_dir("news_upload/$year/$month/$day")) { touch("news_upload/$year/$month/$day/$title.php"); } else { mkdir("news_upload/$year/$month/$day"); touch("news_upload/$year/$month/$day/$title.php"); } } else { mkdir("news_upload/$year/$month"); mkdir("news_upload/$year/$month/$day"); touch("news_upload/$year/$month/$day/$title.php"); } } else { mkdir("news_upload/$year"); mkdir("news_upload/$year/$month"); mkdir("news_upload/$year/$month/$day"); touch("news_upload/$year/$month/$day/$title.php"); } } Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted August 8, 2010 Share Posted August 8, 2010 mkdir can create directories recursively. So your above code can be reduced down to mkdir("news_upload/$year/$month/$day", 0777, true); touch("news_upload/$year/$month/$day/$title.php"); Quote Link to comment Share on other sites More sharing options...
daxguy Posted August 8, 2010 Author Share Posted August 8, 2010 can i add the file permisson to the touch as well? like touch("news_upload/$year/$month/$day/$title.php",0777, true); ??? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted August 8, 2010 Share Posted August 8, 2010 no but you can change a file/folders chmod values using chmod Quote Link to comment Share on other sites More sharing options...
daxguy Posted August 8, 2010 Author Share Posted August 8, 2010 thnx allottt!! Quote Link to comment 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.