suzzane2020 Posted June 28, 2007 Share Posted June 28, 2007 Hi, I have a strange issue here. I have written a script to make a directory and ten copy a file to that directory. I have given the directory full prmissions using the chmod function. The directory is created but am not able to copy the file. here is the code if(isset($_POST["reg"])) { $brand = $_POST["brand"]; $file_name = "template1.php"; $file_path = "brand_sites"; if(!is_dir("$file_path/$brand")) {mkdir("$file_path/$brand/"); chmod("$file_path/$brand/",0777);} if(copy("$file_path/$file_name","$file_path/$brand/$file_name")) { print "Copied"; } } Whats strange is that -if i create a folder manually and give it permissions the file can be copies using the function. could anyone please throw some light on this problem. thank you Quote Link to comment Share on other sites More sharing options...
suzzane2020 Posted June 28, 2007 Author Share Posted June 28, 2007 somebody...anybody ??? Quote Link to comment Share on other sites More sharing options...
teng84 Posted June 28, 2007 Share Posted June 28, 2007 i dont understand but try to see the error i found if(isset($_POST["reg"])) { $brand = $_POST["brand"]; $file_name = "template1.php"; $file_path = "brand_sites"; if(!is_dir("$file_path/$brand")) {mkdir("$file_path/$brand/");//error ------ terminator chmod("$file_path/$brand/",0777);} if(copy("$file_path/$file_name","$file_path/$brand/$file_name")) { print "Copied"; } } that will kill the if condition Quote Link to comment Share on other sites More sharing options...
teng84 Posted June 28, 2007 Share Posted June 28, 2007 oops sorry wrong post Quote Link to comment Share on other sites More sharing options...
suzzane2020 Posted June 28, 2007 Author Share Posted June 28, 2007 hmm actually i want to bring to your attention that if i create the folder manually and give it permissions .the same script works great!!!! its only when i use the mkdir and the chmod function. But i need to use them too ??? Quote Link to comment Share on other sites More sharing options...
teng84 Posted June 28, 2007 Share Posted June 28, 2007 http://www.php.net/manual/en/function.copy.php#55130 try that one Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted June 28, 2007 Share Posted June 28, 2007 chmod("$file_path/$brand/",0777); Instead of using "0777", try just "777". chmod("$file_path/$brand/",777); Quote Link to comment Share on other sites More sharing options...
suzzane2020 Posted June 29, 2007 Author Share Posted June 29, 2007 ok let me try that 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.