hi! i'm trying to upload an image in my site. But the error occur.
Warning: chmod(): Operation not permitted in /www/clanteam.com/i/s/e/isellitem/htdocs/test3.php on line 9
Warning: move_uploaded_file(): Unable to access try/2010 BMW M3 Sedan Front View.jpg in /www/clanteam.com/i/s/e/isellitem/htdocs/test3.php on line 10

php code:


echo "successfully uploaded";

i'm doing alternative ways to this problem but the same error occur. Me I know what is the problem with my code.

please help me guys.

7 Years
Discussion Span
Last Post by canterorist

Hello canterorist,
two things.
1) Do you or do you not know your server running in safe mode.
2) If it isnt then you just don't have the permissions to change the permissions of that file. If the file was made with php, then it should, otherwise, I'm sure that's the problem.



Looks like linux which does not need safe mode..... The problem is coming from one of two things:

1) You apache is set to prevent people from posting files to the server and making them executable (try chmod 666 <Filename> instead of 0777). Using 0777 gives read, write, execute permission to the owner, owners group and everyone else that touches the site. you don't want a world writeable - executable file on the server. someone will post a script over it and hack the server.

2) You don't own the file you are trying to change. try running the following from command line and see who ownes the file:

ls -la <filename>

For a solution check out "umask". It is the file creation mask that sets permissions for files created by a specific user. There is a umask variable set in the /etc/bashrc file.

setting a umask of 111 prior to the upload would give the same result as doing a chmod 666.
system subtracts the values from 777 to get permissions (i.e 777 - 111 = 666)
umask 022 is the same as chmod 755.

Edited by rch1231: listed wrong file name


sorry guys for late reply. I already solve the problem. thanks for your advice.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.