Forum Moderators: coopster

Message Too Old, No Replies

Image upload directory

what permissions

         

blind

4:27 am on Aug 5, 2003 (gmt 0)

10+ Year Member



hey all wasnt sure where to post this but i have just got a simple PHP script which uploads an image to a folder. But it only works when the image folder is set to 777 else permission denied. how do i make it so the folder can be set to 755 or 744 and still be able to upload images to that directory. server is apache on unix

vincevincevince

7:19 am on Aug 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



is php shared between muliple accounts? i (think) it needs 575, or 557 if so (fuzzy memory) - because it's not acting as owner (if it was owner, all accounts would have same owner, and you could ftp into anyone's site...) i guess someone more savvy with this will help more

bilalak

7:35 am on Aug 5, 2003 (gmt 0)

10+ Year Member



You can not
it should be 777 because the Web server or PHP module would write to this directory and the web server run as 0777.

blind

10:45 am on Aug 5, 2003 (gmt 0)

10+ Year Member



isnt this a security risk though?

someone said
"it doesn't need to be 777, it can be 774 or whatever, as long as the group that apache is running as has write access"

vincevincevince

5:53 pm on Aug 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



here's something - store the files in your database ;) kill 2 birds with 1 stone

blind

10:09 pm on Aug 5, 2003 (gmt 0)

10+ Year Member



u can store images in a mySQL database?

mat_bastian

10:11 pm on Aug 5, 2003 (gmt 0)

10+ Year Member



yes

search it in google, there is loads of instruction for it.

blind

10:29 pm on Aug 5, 2003 (gmt 0)

10+ Year Member



cool cheers
ill look at doin that then sounds better

vincevincevince

10:56 pm on Aug 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



storing images in the database is little different to storing any file, so find a file upload script

when you output, remember to set the correct content-type for your headers - this can be found as it uploads, so don't forget to record it :)

jatar_k

11:02 pm on Aug 5, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I wouldnt really store the actual images in the db just the path to where they live.

blind

2:39 am on Aug 6, 2003 (gmt 0)

10+ Year Member



yeah i had the path of the image stored in the db and the images in a images folder and this works great but i just wanted to know how to do it so the folder where the images get uploaded can be set to 755 rather then 777

panic

5:18 pm on Aug 6, 2003 (gmt 0)

10+ Year Member



You can push the binary into a MySQL db, along with the file extension so that PHP knows what MIME type to use when getting the binary data from MySQL.

-panic