jure_matjaz Posted October 28, 2006 Share Posted October 28, 2006 Hello!I have problem with sub folder creation. I have tried with mkdir and even with shell_exec. Can you help. Here is the code....---first code----<?php mkdir("album", 0777);chmod("album", 0777);//i've added this because it didn't want to set permisions to 777mkdir("album/1/", 0777);if (file_exists("album/")) { echo "Mapa obstaja";} else { echo "Mapa ne obstaja";}if (file_exists("album/1/")) { echo "<br>Podmapa obstaja";} else { echo "<br>Podmapa ne obstaja";}?>----end----------second_code------<?php shell_exec('mkdir album'); chmod("album", 0777);shell_exec('cd album/ ; mkdir 1'); if (file_exists("album/")) { echo "Mapa obstaja";} else { echo "Mapa ne obstaja";}if (file_exists("album/1/")) { echo "<br>Podmapa obstaja";} else { echo "<br>Podmapa ne obstaja";}?>---end----Thank you for your help! Jure Link to comment https://forums.phpfreaks.com/topic/25399-folder-and-sub-folder-creation-error/ Share on other sites More sharing options...
ToonMariner Posted October 28, 2006 Share Posted October 28, 2006 you may need to use umask(); and also check to see if open_basedir is set on the server - if it is you will only be able to get php to manipulate the files/folders within that floder. Link to comment https://forums.phpfreaks.com/topic/25399-folder-and-sub-folder-creation-error/#findComment-115852 Share on other sites More sharing options...
jure_matjaz Posted October 28, 2006 Author Share Posted October 28, 2006 Hello! At first i want to thank you, for your interest in problem... I've tried useing umask, but folder has permisions(777) even without umask, so i think this isn't a problem.I contacted my server administrator, to disable open_basedir function. But i didn't get reply ... so i don't know jet, if there is a problem. Thank you for your help! Jure Link to comment https://forums.phpfreaks.com/topic/25399-folder-and-sub-folder-creation-error/#findComment-115931 Share on other sites More sharing options...
jure_matjaz Posted October 28, 2006 Author Share Posted October 28, 2006 Hello again. Now i've tried to use script with disabled open_basedir function, and it didn't work. I don't get it... i have one function on other page for uploading pictures and i use .... ...shell_exec('cd slike/ ; mkdir ' . $album . ' ');... function and it's working fine.If i wan't to create folder with shell_exec here, it doesn't work....If you have any other ideas, please let me know.Thank you for your help! Jure Link to comment https://forums.phpfreaks.com/topic/25399-folder-and-sub-folder-creation-error/#findComment-115936 Share on other sites More sharing options...
jure_matjaz Posted October 30, 2006 Author Share Posted October 30, 2006 Hello! Please if anybody can try this on his server, so i figure it out, if there is problem in code or server...--------folders.php----------<?php mkdir("folder1", 0777);chmod("folder1", 0777);//i've added this because it didn't want to set permisions to 777mkdir("folder1/folder2/", 0777);if (file_exists("folder1/")) { echo "Folder exists";} else { echo "Folder doesn't exist";}if (file_exists("folder1/folder2/")) { echo "Sub-folder exists";} else { echo "Sub-folder doesn't exist";}?>----------end------------------[b]It should make folder1 and sub-folder folder2 in folder1[/b]Thank you for your help! Jure Link to comment https://forums.phpfreaks.com/topic/25399-folder-and-sub-folder-creation-error/#findComment-116599 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.