0

I am trying to upload a file to a directory. Directory Exists but it says

Warning: move_uploaded_file(/home/icq3zr1l9m6h/public_html/wp-content/uploads/jambalaio/logo/AF_Logo_APP_Branco [Converted].png): failed to open stream: No such file or directory in /home/icq3zr1l9m6h/public_html/wp-content/themes/astra-child/includes/jambalaioApp.php on line 14

This is working fine on localhost but not working on live site. Can you please tell me what can be the possible Error!

Code is

$target_dir_logo = ABSPATH."wp-content/uploads/jambalaio/logo/";
$target_file_logo = $target_dir_logo . basename($_FILES["logo"]["name"]);
//$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file_logo,PATHINFO_EXTENSION));
move_uploaded_file($_FILES["logo"]["tmp_name"], $target_file_logo);

$target_dir_bg = ABSPATH."wp-content/uploads/jambalaio/background/";
$target_file_bg = $target_dir_bg . basename($_FILES["bg-image"]["name"]);
//$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file_bg,PATHINFO_EXTENSION));
move_uploaded_file($_FILES["bg-image"]["tmp_name"], $target_file_bg);

1 Answers1

1

This error it's probably because the PHP has no visibility over the /home/{user} folder. I usually use a path originating from the website ROOT instead of the OS ROOT.

Edit: BTW, make sure those folders have the proper permissions.