question about uploading a file

I am using ubuntu operating system. and uses xampp tool for php.
When am upload a file browser gives error as follows:

Warning: move_uploaded_file(up/Screenshot from 2015-04-04 13:52:15.png): failed to open stream: Permission denied in /opt/lampp/htdocs/hyd/php/7-link.php on line 8

Warning: move_uploaded_file(): Unable to move ‘/opt/lampp/temp/phpkrCk54’ to ‘up/Screenshot from 2015-04-04 13:52:15.png’ in /opt/lampp/htdocs/hyd/php/7-link.php on line 8
not

my program is as follows:

<?php //print_r($_FILES); //$ofn=$_FILES['f1']['type']; //echo "
".$ofn; $ofn=$_FILES['f1']['name']; //echo "
".$ofn; is_uploaded_file($_FILES['f1']['tmp_name']); if(move_uploaded_FILE($_FILES['f1']['tmp_name'],"up/$ofn")) echo "file is moved"; else echo "not"; ?> select file:

please help me to solve this error

It isn’t you code, it is your permission level on the directories.

chmod 755 /htdocs/hyd/php/

Narendra,

Astonecipher is talking about your folder on the server. It is named “up”.
You must log into your server and alter the permissions on that folder to at least 755.

CHMOD is the command you use. Here is a link to further info for you to read up on it.
https://help.ubuntu.com/community/FilePermissions

Sponsor our Newsletter | Privacy Policy | Terms of Service