Clarky Posted February 4, 2007 Share Posted February 4, 2007 Hi, I seem to be able to create new directories using php - but deleting, or uploading files is giving me problems. My directories are chmod 0777, i'm wondering if theres a setting in apache i need to change to allow uploads, and deletion of directories? Link to comment https://forums.phpfreaks.com/topic/37033-uploadingdeleting-files-dir-with-php-on-apache/ Share on other sites More sharing options...
trq Posted February 4, 2007 Share Posted February 4, 2007 No... this would have nothing to do with Apache. Who owns these files? eg; What is the ouput of..... ls -l dirname Link to comment https://forums.phpfreaks.com/topic/37033-uploadingdeleting-files-dir-with-php-on-apache/#findComment-176806 Share on other sites More sharing options...
Clarky Posted February 4, 2007 Author Share Posted February 4, 2007 Running it on my localhost, so the owner wud be my account: brought it up in the terminal and got this: drwxrwxrwx 2 Clarky Clarky 68 Feb 2 00:16 Calvin Z drwxrwxrwx 4 Clarky Clarky 136 Feb 2 20:19 David Tan drwxrwxrwx 4 Clarky Clarky 136 Feb 2 20:18 Eric drwxrwxrwx 5 Clarky Clarky 170 Feb 2 20:18 Julian drwxrwxrwx 4 Clarky Clarky 136 Feb 2 20:18 MaoMao drwxrwxrwx 4 Clarky Clarky 136 Feb 1 22:16 SynRG -rwxrwxrwx 1 Clarky Clarky 7981801 Jan 18 09:58 test.mp3 -rwxrwxrwx 1 Clarky Clarky 10386439 Jan 18 09:58 test2.mp3 Link to comment https://forums.phpfreaks.com/topic/37033-uploadingdeleting-files-dir-with-php-on-apache/#findComment-176811 Share on other sites More sharing options...
trq Posted February 4, 2007 Share Posted February 4, 2007 Running it on my localhost, so the owner wud be my account If the files where uploaded via php then they should be owned by whoever owns the Apache process. Usually this is apache. You cannot delete or modify these files because apache does not have permission to do so. Link to comment https://forums.phpfreaks.com/topic/37033-uploadingdeleting-files-dir-with-php-on-apache/#findComment-176816 Share on other sites More sharing options...
Clarky Posted February 4, 2007 Author Share Posted February 4, 2007 I'm having issues uploading and deleting files: i've written this function to delete files/directories: function DeleteFileOrDir($file) { if(is_dir($file)) { if(rmdir($file)) { return true; } } else { if(unlink($file)) { return true; } } return false; } Link to comment https://forums.phpfreaks.com/topic/37033-uploadingdeleting-files-dir-with-php-on-apache/#findComment-176866 Share on other sites More sharing options...
trq Posted February 4, 2007 Share Posted February 4, 2007 And the problem now is? Link to comment https://forums.phpfreaks.com/topic/37033-uploadingdeleting-files-dir-with-php-on-apache/#findComment-176868 Share on other sites More sharing options...
Clarky Posted February 4, 2007 Author Share Posted February 4, 2007 Nah, its the same issue - i just posted the code up in the php section as u said it wasnt a apache issue... I get these permission warnings and such... i mean creating directories with the php script works a treat - just not getting rid of them or uploading them.. kinda at a loss at wat to do on the matter Link to comment https://forums.phpfreaks.com/topic/37033-uploadingdeleting-files-dir-with-php-on-apache/#findComment-176873 Share on other sites More sharing options...
trq Posted February 4, 2007 Share Posted February 4, 2007 As I said, the files and directories need to be owned by apache. Link to comment https://forums.phpfreaks.com/topic/37033-uploadingdeleting-files-dir-with-php-on-apache/#findComment-176876 Share on other sites More sharing options...
Clarky Posted February 4, 2007 Author Share Posted February 4, 2007 what does that mean exactly? is it possible to get it to work then? not that knowledgable on apache Link to comment https://forums.phpfreaks.com/topic/37033-uploadingdeleting-files-dir-with-php-on-apache/#findComment-176877 Share on other sites More sharing options...
Clarky Posted February 4, 2007 Author Share Posted February 4, 2007 I;m guessing i can use the chown() function in php, but this isnt just a problem with the script i'm writting, but with all file manager scripts/my SMF forum, its just generally on my localhost - i cant do upload or delete files or directories Link to comment https://forums.phpfreaks.com/topic/37033-uploadingdeleting-files-dir-with-php-on-apache/#findComment-176918 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.