views:

25

answers:

2

I have an PHP website on a RHEL5/CentOS dedicated server. The website is located at /var/www/html/beta

I have a script:

/var/www/html/beta/scriptA.php

which calls a function in

/var/www/html/beta/code/inc/functions.php

The function uses move_uploaded_file() as follows:

$status = move_uploaded_file($imagetmp_name,$destinationPath);

Printing these values shows:

imagetmp_name=/tmp/phpiECxB6
destinationPath=in_upload/images/907770756_publicpage.jpg
status=false

Which I thought should have worked since 'in_upload/images' exists:

drwxr-xr-x  5 root root   4096 Oct 19 07:40 in_upload

and

drwxr-xr-x  2 root root  4096 Oct 19 07:40 images

What am I doing wrong?

A: 

You do not seem to have write rights on the images folder.

bazmegakapa
+1  A: 

You don't have writing permisions to in_upload neither images, only for root.

Use

chmod a+w in_upload
chmod a+w images

or change that directories' owner/group to the user, under which is apache running. example:

chown apache:apache in_upload
chmod g+w in_upload
Yossarian
worked like a charm!
matt_tm