A simple script to upload the image gives permission error, the directory permission is 755. It works fine when it is set to 777. I wonder if there is any problem with this:
//upload the image
$dir="../content_images/";
$image_path = time().$_FILES[id_image][name];
$id_image=$dir.$image_path;
copy($_FILES[id_image][tmp_name], $id_image);
well, the script should run fine with the permission 755 as u can see 7 for owner or the script says that you have the write permission. I wonder why it doesn’t work?
755 will only work if the folder or directory is owned by the webserver,e.g. apache or www…if it’s set to “root” then only that account can write on it unlike 777 that allows all.
If you’re using unix like boxes setting 755 within document_folder and you want the web server process to write on it, it should be owned by the running process…e.g. web server like “chown apache myfolder” otherwise, stick with 777.