msdan Posted May 25, 2004 Posted May 25, 2004 Hi, I have an account with totalchoicehosting and I'm trying to write a php photo gallery. I want to let the site members to create their galleries by uploading their pictures in a folder named after their account name (). So the problem is to create a new folder through script and give write permissions for this folder. I tried to use chmod for changing the permissions, but I'm getting this error: <b>Warning</b>: chmod(): Operation not permitted in <b>/home/.../public_html/image.php</b> on line <b>...</b><br /> <br /> This is the first problem (dynamically setting permission for a new folder). Another problem: I wrote an upload module and I'm getting this error this time: Warning: mkdir(/usr/local/apache/htdocs/images): Permission denied in /home/.../public_html/test.php on line 99 Error: Directory does not exist and was unable to be created. even I changed permissions for the folder. Thanks for your responses. Quote
TCH-Thomas Posted May 25, 2004 Posted May 25, 2004 Why not try one of the already made galleries like ht*p://coppermine.sourceforge.net/ or ht*p://gallery.menalto.com/modules.php?op=modload&name=News&file=index to name a few? Quote
msdan Posted May 25, 2004 Author Posted May 25, 2004 Even if I'm gonna use a free php module I will not get it working; because the problem seems to be the permissions on the uploading folder. Quote
TCH-Don Posted May 25, 2004 Posted May 25, 2004 Are you usinf cpanels file manager? I have had mixed results with it and now just use an ftp program to change permissions. Quote
msdan Posted May 25, 2004 Author Posted May 25, 2004 Are you usinf cpanels file manager?I have had mixed results with it and now just use an ftp program to change permissions. Thank you guys, I figured out the all thing: I changed permissions through cpanel for my "parent" folder and when I am uploadingthe picture, I'm building in the same time the new folder with writing permissions and then saving the picture right there. It's working. ><form enctype="multipart/form-data" action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="2048000"> File: <input name="userfile" type="file" /><br /> <input type="submit" value="Upload" /> </form> <?php if (@is_uploaded_file($_FILES["userfile"]["tmp_name"])) { mkdir("images/gallery/dir1", 0777); copy($_FILES["userfile"]["tmp_name"], "images/gallery/dir1/" . $_FILES["userfile"]["name"]); echo "<p>File uploaded successfully.</p>"; } ?> ... so first I modified permissions with cpanel for gallery folder and the all the new folders I'm creating them with 0777 parameter. Quote
TCH-Don Posted May 25, 2004 Posted May 25, 2004 Good Thumbs Up and oh yes, Welcome to the family Quote
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.