Yii and image upload with CHMOD755


Each time I try to upload an image via YII to an upload folder, the script requires to have the folder set with CHMOD777, Is there a way to program Yii in a way that it accepts to upload to a folder with CHMOD755?

Thank you,

You need to let your web server user have access to the upload folder. I suggest you set your web server user as group owner of the upload folder.

On Ubuntu the Apache2 user is www-data. Command to set user as group owner:

chown -R :www-data <foldername>

thank you so much , I will ask my server support to change that then:-)

Thanks again!


may be you can use this :

mkdir("/path/to/my/dir", 0777);

while creating the folder.