I am having an issue uploading an image to my server, any help would be greatly appreciated. See below:
$sql = "SELECT avatar FROM users WHERE username='$log_username' LIMIT 1";
$query = mysqli_query($db_conx, $sql);
$row = mysqli_fetch_row($query);
$avatar = $row[0];
if($avatar != ""){
$picurl = "../user/$log_username/$avatar";
if (file_exists($picurl)) { unlink($picurl); }
else if(!file_exists($picurl)){
mkdir($picurl, 0777,true);
}
}
$moveResult = move_uploaded_file($fileTmpLoc, "../user/$log_username/$db_file_name");
if ($moveResult != true){
echo "ERROR: File not uploaded. Try again.";
unlink($fileTmpLoc); // Remove the uploaded file from the PHP temp folder
exit();
}
The issue I am having is with
$moveResult = move_uploaded_file($fileTmpLoc, "../user/$log_username/$db_file_name");
These are the errors that are generating when I try to process the request:
Warning: move_uploaded_file(../user/test/269941961951.PNG): failed to open stream: No such file or directory in /home/test1/public_html/php_parsers/photo_system.php on line 62
Warning: move_uploaded_file(): Unable to move '/tmp/phpo0OWwN' to '../user/test/269941961951.PNG' in /home/test1/public_html/php_parsers/photo_system.php on line 62
ERROR: File not uploaded. Try again.
I know that it exists in the DIR.
If anyone could help it would be great thanks.