Image upload not working

Works locally but not live.
My file location is
And where i want the image to go is

Warning i get live is:
Warning: move_uploaded_file(…/images/products/wolf - Copy.jpg): failed to open stream:
Permission denied in /usr/local/pem/vhosts/171950/webspace/httpdocs/ on line 46

Warning: move_uploaded_file(): Unable to move ‘/usr/local/pem/vhosts/171950/tmp/phpOWqMkC’ to ‘…/images/products/wolf - Copy.jpg’ in /usr/local/pem/vhosts/171950/webspace/httpdocs/ on line 46

And this is my code.

        $target = "../images/products/";
        $target = $target . basename($_FILES['photo']['name']);

        $pname = $_FILES['photo']['name'];
        $ptemp = $_FILES['photo']['tmp_name'];
        $ptype = $_FILES['photo']['type'];
        $psize = $_FILES['photo']['size'];

        if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)){

Really confused and stuck

1/ Echo out your variables to see what they contain.

2/ This looks like your problem “Unable to move '/usr/local/pem/vhosts/171950/tmp/phpOWqMkC” as the file does not have an extension and it is to much of a coincidence to be a random name starting with php.

Variables are as following

Target: …/images/products/sm-wolf.jpg
pname: sm-wolf.jpg
ptemp: /usr/local/pem/vhosts/171950/tmp/phpWKgPrd
ptype: image/jpeg
psize: 11389

Also i tried the w3schools uploading and it didnt work. Worked locally but not live

As I say this looks wrong “ptemp: /usr/local/pem/vhosts/171950/tmp/phpWKgPrd” Again your tempory file is starting with php.

Have you changed the permissions on the …/images/products/ folder to either 777 or 755 ?

Sorry im a bit of a noob with file uploads. Just have the code from above in the addproduct.php file and want it to locate the image up a level and back into images/products.

No idea about permissions. Im using blacknight hosting

Actually im using htaccess to change .php to .html with this
RewriteEngine on
RewriteRule ^(.*)\.html$ $1.php

Do you know if you are on a Windows or Linux server?

Well im using apache so im assuming its linux.
Cant figure this out. Head is wrecked

As you say probably Linux

It looks like your problem is a permission one as you have the error "Permission denied ".

I am not sure if moving a file needs the folder permissions changing but I would try changing the permission of products to 777

In your FTP program when you look at the folder it probably has a permission of 644 try changing that to 777 - right click on the foldername - change permission. You may be able to set ti to 757 or 755 if this works.

Should i do that to images folder and products folder within it?

Everything working now. thank you ever so much