johnrb87 Posted April 30, 2011 Share Posted April 30, 2011 Hi I have a script mkdir("myitems/images", 0777); chmod("myitems/images", 0777); if (!copy('downloads.zip', 'myitems/images/downloads.zip')) { echo "failed"; } when I run it, the folder is created and when checking folder permissions, it shows 777 but it fails on copying the file. if I manually create the folder "myitems/images/" and set it to 777, then when I run the script, the file is copied for some reason when I manually create the folder it works, but when PHP creates the folder, it fails on something any ideas? racking my brain trying to figure out why Quote Link to comment https://forums.phpfreaks.com/topic/235202-cant-use-copy-on-a-mkdir-folder/ Share on other sites More sharing options...
fugix Posted April 30, 2011 Share Posted April 30, 2011 do you get any errors when running this script? Quote Link to comment https://forums.phpfreaks.com/topic/235202-cant-use-copy-on-a-mkdir-folder/#findComment-1208693 Share on other sites More sharing options...
fugix Posted April 30, 2011 Share Posted April 30, 2011 also..the mode for mkdir() is 0777 by default..and does not need to be stated in your function Quote Link to comment https://forums.phpfreaks.com/topic/235202-cant-use-copy-on-a-mkdir-folder/#findComment-1208696 Share on other sites More sharing options...
johnrb87 Posted April 30, 2011 Author Share Posted April 30, 2011 nope, no errors at all, really strange Quote Link to comment https://forums.phpfreaks.com/topic/235202-cant-use-copy-on-a-mkdir-folder/#findComment-1208697 Share on other sites More sharing options...
fugix Posted April 30, 2011 Share Posted April 30, 2011 can you look at the directory that php created....and state what the permissions are on it please Quote Link to comment https://forums.phpfreaks.com/topic/235202-cant-use-copy-on-a-mkdir-folder/#findComment-1208698 Share on other sites More sharing options...
johnrb87 Posted April 30, 2011 Author Share Posted April 30, 2011 777 is set on the folder php creates Quote Link to comment https://forums.phpfreaks.com/topic/235202-cant-use-copy-on-a-mkdir-folder/#findComment-1208768 Share on other sites More sharing options...
teddyb Posted May 1, 2011 Share Posted May 1, 2011 can you try <?php error_reporting(E_ALL); mkdir("myitems/images", 0777); chmod("myitems/images", 0777); copy('downloads.zip', 'myitems/images/downloads.zip'); and post any warnings / notices Quote Link to comment https://forums.phpfreaks.com/topic/235202-cant-use-copy-on-a-mkdir-folder/#findComment-1208859 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.