Page 1 of 2

Uploaded Images Permissions Problem

Posted: Thu 20. May 2004, 09:56
by NetCleric
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.

Posted: Thu 20. May 2004, 13:31
by Oliver Georgi
Based on your settings - change the permissions by FTP.

Oliver

Posted: Thu 20. May 2004, 20:08
by NetCleric
Forgive me but i dont really understand. I can change the individual picture file permissions so that they work through my file manager but thats kind of a pain in the butt. What settings can I change?

Thanx again.

Posted: Thu 20. May 2004, 21:34
by Pappnase
hello

if i understand Oliver g. right did you need to change your chmod.

Posted: Thu 20. May 2004, 22:08
by NetCleric
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.

Posted: Thu 20. May 2004, 22:36
by Pappnase
hello

so i don't really understand where the problem is! i even tryed it at one of my sites! upload via spaw as admin and then the same as an normal user! both made now problems don't see any permission problems!
or is the problem the editing of contentparts as an normal user!?

Posted: Thu 20. May 2004, 23:50
by NetCleric
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.

Posted: Fri 21. May 2004, 00:09
by Pappnase
so i checked it once again! i upload a picture via spaw then try to insert it! preview and inserting and it works fine!

what is the chmod of your picture dir!?

Posted: Fri 21. May 2004, 00:44
by NetCleric
picture/ dir is 755 (also tried 777 to no avail). Pictures themselves are 600.

Posted: Fri 21. May 2004, 03:59
by DeXXus
NetCleric wrote:picture/ dir is 755 (also tried 777 to no avail). Pictures themselves are 600.
When ~I~ did the upload via Spaw... the "filename" was set to chmod 755 in the "./picture" directory.

Posted: Fri 21. May 2004, 08:33
by Oliver Georgi
600 is not enough - it has to be 644. This seems to be a configuration problem.

UPDATE: yes Dexxus, you are right ;-)

Oliver

Posted: Fri 21. May 2004, 09:02
by DeXXus
Oliver Georgi wrote:644 is not enough - it has to be 644. This seems to be a configuration problem.

Oliver
I ~believe~ Oliver "means" 600 is not enough - it has to be 644.

Posted: Fri 21. May 2004, 10:05
by pSouper
I was thinking Olvier had unpresedented control over 'magic math' :)
I use Thirty-Twelve and Eleventeen alot in order to get the results i need.

I would write down thier symbols for you all but you need a Four-Hundred and Twentyloads character font ;)

Posted: Sat 22. May 2004, 00:54
by NetCleric
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 --

Code: Select all

      if (!move_uploaded_file($data['tmp_name'], $dir_name.$img_name)) {
        $errors[] = $l->m('error_uploading');
        return false;
      }
and before -

Code: Select all

      return $img_name;
add

Code: Select all

      if (!chmod($dir_name.$img_name, 0644)) {
	    $errors[] = $l->m('error_permissions');
        return false;
      }
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:

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.

Posted: Sat 22. May 2004, 00:57
by NetCleric
And I almost forgot, thanx to those that helped me and once again --> great cms, cant wait for the next release to see whats new :).