circsoc wrote:
Hi guys, I've had a fair bit of luck with the help I've gotten off you in the past so hopefully you can help me here.
I'm creating a photo gallery component for my new site, during the installation of the component it creates all the necessary files and folders, including the folder I wish to save user submitted photos to. This folder is in the directory components/com_photoalbum/images. However my script can not save files to this folder as by default the permission are 755. If I manually change the permissions to 777 it works fine.
It may seem like this isn't a problem, but I'd like to publish this component in the JED and want set up to be as easy and secure as possible, and don't want people to have to chmod that directory themselves.
I've tried this code in my script chmod("components/com_photoalbum/images", 0777); but this doesn't work.
What can I do to make a that directory writeable from my script? If it makes a difference my test site runs on PHP 4, but i also want it to work on PHP 5. Also when i install the component I'm installing from my tmp directory rather than uploading the .zip via FTP
Any help would be greatly appreciated, and would help me share my work with the community.
THe problem isn't your component, the problem is your server.
Make sure that the PHP/Apache user is the user that owns your files and directories. 755 and 644 should be sufficient if your server is setup properly. You also should be using JFile rather than directory PHP file system calls so that your extension will automatically use the FTP layer if it is enabled.
Ian