Advice on image upload and permissions

fozzyo

Guppy
I'm just after some advice on how to resolve an issue I'm having.

I'm writing a small PHP app that allows users to upload an image to an 'images' folder. They can then manipulate this (resize, rotate, crop, delete, restore from a copy of the original file).

I understand all the security steps for uploading images, use of .htaccess file on the images folder, checking file size, extension, header type etc. And I'm putting all the code in place for that.

The problem I have is with permissions. I can upload the file but then I hit a brick wall - the file is then created as the httpd user / group and consequently I can't do anything with that image until up to 24hours later when the script as run to reset the ownership to apply to quota's etc.

Is there a way around this? From my PHP code can I get the script to scan the folder to immediately reassign the permissions?

Any help or suggestions would be most appreciated or welcome!

Thanks
Mat
 
Hello Mat,

Not very secure, but you can set write bit set for 'others', i.e. a permission set like 666 for these images that will allow you to manipulate them via web (PHP) as well as FTP. You can use PHP's chmod function for this that can be run once the file is successfully uploaded.
 
Back
Top