Forum Moderators: coopster
For a long time now I have built into my CMS's image upload features, but the target folder always needs full permissions of 0777 for PHP to be able to copy the uploaded image into it.
This always has been a risky affair but due to the fact the websites were small it didn't really matter.
I am now doing a moderately big job and I want to have more secure image uploads, aka ones without having to 0777 the folder.
My question is, what is the best way of uploading images to a server via POST and PHP?
Thank you
[18:15:31] 257 "/httpdocs/photos/nature" is current directory.
[18:15:31] SITE CHMOD 666 thumbs
[18:15:31] 200 SITE CHMOD command successful
So, the directory /httpdocs/photos/nature/thumbs/ is now CHMOD 666.
So, I run my PHP script, which for note, is not located within this folder, and I get this error,
Warning: move_uploaded_file(../../../../../../httpdocs/photos/nature/thumbs/nature_2006-05-30_001.jpg): failed to open stream: Permission denied in /var/www/vhosts/***********/subdomains/*******/httpdocs/system/core/class_image.php on line 140
No error and works with CHMOD 777 though. :/
What permissions do I need to give to the folder and the PHP file running the script?
I have tried setting the PHP file to CHMOD 777 and the folder to CHMOD 666 and still I get "Permission Denied" errors when running the PHP code.
This is a dedicated server I'm on so I can alter any server settings if need be.
I am very new to this and I just want to do it right this time. If anyone knows a tutorial or anything like that, can you forward it to me?
Thank you.
I'm getting a feeling here I may not have set something I needed to. :(