Uploaded Images Permissions Problem
Uploaded Images Permissions Problem
I have scoured the forums but did not see this probem listed anywhere. The problem being: When I upload an image through the SPAW (I think) WYSIWYG Editor it sets the pictures permissions to Admin -read-write only (No Group or User -read permission). As a result if you try to view the image in the browser you get a permission denied error.
How can I fix this so that the image is set to Admin, Group, and User -read automatically?
Thanx for your help (sorry if this is a repeat or something obvious im missing -- I really did look for the answer before posting). Also, not to make this post any longer, I just started using phpWCMS and I just wanted to say Bravo! I love it.
How can I fix this so that the image is set to Admin, Group, and User -read automatically?
Thanx for your help (sorry if this is a repeat or something obvious im missing -- I really did look for the answer before posting). Also, not to make this post any longer, I just started using phpWCMS and I just wanted to say Bravo! I love it.
- Oliver Georgi
- Site Admin
- Posts: 9900
- Joined: Fri 3. Oct 2003, 22:22
- Contact:
I see, so you mean I have to set up chmod on the server to have read for all as default on upload? Im guessing this is something my host would have to do or am I missing something?
If I upload files through an FTP client (Dreamweaver) I get normal permissions but when I upload through spaw I get the admin only permissions. I have to say I dont really understand that. I have made my own scripts to upload images to my server and i have never seen anything about setting permissions or had any trouble with odd permissions on upload. Im really sorry im not getting this, im sure its something simple im just missing.
If I upload files through an FTP client (Dreamweaver) I get normal permissions but when I upload through spaw I get the admin only permissions. I have to say I dont really understand that. I have made my own scripts to upload images to my server and i have never seen anything about setting permissions or had any trouble with odd permissions on upload. Im really sorry im not getting this, im sure its something simple im just missing.
Well, im starting to think it must be a problem with the way the server is setup.
I login as Admin and then create a new article. Then I click on the insert image button and at the bottom of that pop up is the upload option so I browse my comp and throw in an image and hit upload. The image uploads fine and appears in my list of images under the pictures/ directory but when I click on the image to preview it I get window that says something about not having permission to view the file (Browser Default 403 error I think, not a spaw or wcms error page). Also, does the same thing if I upload to root directory phpwcms.
So anyways I went into the file manager app that came with my hosting package and check the permissions. The pictures directory has the correct permissions but the image files I uploaded in the folder have there permissions set to admin read write only. To my understanding, by default on upload, the images should have there permissions set to admin -r -w and group, user should have -read access as well.
What the heck? Im sorry to be a pain here but I really like phpWCMS and I just want to get everything working right.
I login as Admin and then create a new article. Then I click on the insert image button and at the bottom of that pop up is the upload option so I browse my comp and throw in an image and hit upload. The image uploads fine and appears in my list of images under the pictures/ directory but when I click on the image to preview it I get window that says something about not having permission to view the file (Browser Default 403 error I think, not a spaw or wcms error page). Also, does the same thing if I upload to root directory phpwcms.
So anyways I went into the file manager app that came with my hosting package and check the permissions. The pictures directory has the correct permissions but the image files I uploaded in the folder have there permissions set to admin read write only. To my understanding, by default on upload, the images should have there permissions set to admin -r -w and group, user should have -read access as well.
What the heck? Im sorry to be a pain here but I really like phpWCMS and I just want to get everything working right.
- Oliver Georgi
- Site Admin
- Posts: 9900
- Joined: Fri 3. Oct 2003, 22:22
- Contact:
600 is not enough - it has to be 644. This seems to be a configuration problem.
UPDATE: yes Dexxus, you are right
Oliver
UPDATE: yes Dexxus, you are right
Oliver
Last edited by Oliver Georgi on Fri 21. May 2004, 09:22, edited 1 time in total.
Ok, I still dont know why it sets the permissions to 600 by default but here is what I did about it incase anyone else ever has the problem:
Open the file "include/inc_ext/spaw/dialogs/img_library.php" and go to line 295. After --
and before -
add
Now for the error handling open up the file "include/inc_ext/spaw/lib/lang/en/en_lang_data.inc.php" and go to line 56: Make a space and add the line:
.
Incase you didnt catch it or would like to do things diffrently I used the php function chmod() to set the permissions, pretty simple but it works.
Open the file "include/inc_ext/spaw/dialogs/img_library.php" and go to line 295. After --
Code: Select all
if (!move_uploaded_file($data['tmp_name'], $dir_name.$img_name)) {
$errors[] = $l->m('error_uploading');
return false;
}
Code: Select all
return $img_name;
Code: Select all
if (!chmod($dir_name.$img_name, 0644)) {
$errors[] = $l->m('error_permissions');
return false;
}
Code: Select all
'error_permissions' => 'PHP was unable to set file permissions',
Incase you didnt catch it or would like to do things diffrently I used the php function chmod() to set the permissions, pretty simple but it works.