php cannot upload image to server

okay so the task is to upload an image file under home directory upload folder.
I set he permission for that folder to be chmod 777

$f_name = $_FILES['filetoupload']['name'] ;  // get the name of the uploaded file
$f_tmp = $_FILES['filetoupload']['tmp_name']; // temp name and location 


$store = '/home/upload/' . $f_name ; // store it in /home/upload directory
$f_extension= explode('.', $f_name) ;  // extract extension  
$f_extension =  strtolower(end($f_extension))  ; 
$f_newfile = uniqid(). '.' . $f_extension ; 
if($f_extension =='jpg' || $f_extension =='png' || $f_extension == 'gif')// only allowed jpg png gif 
{

    if(move_uploaded_file($f_tmp, $store)) {

/* the above if statement gives me trouble Warning: move_uploaded_file(upload/motivational-wallpaper-5.jpg): failed to open stream: Permission denied in /home/bti320_153a15/public_html/lab4/addPlace.php on line 79
Warning: move_uploaded_file(): Unable to move ‘/tmp/phpXwKiD4’ to ‘upload/motivational-wallpaper-5.jpg’ in /home/bti320_153a15/public_html/lab4/addPlace.php on line 79
*/

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s