On LEMP (Linux CentOS, Nginx, MariaDB, PHP) server, /etc/php.ini file has the following.
file_uploads = on
upload_tmp_dir = /tmp
Stage1.html has the following markup, which is used to select an image file, and post the image to Stage2.php.
<form action="Stage2.php" method="post" enctype="multipart/form-data">
<input type="file" name="upload">
<input type="submit">
</form>
Stage2.php has the following.
<?php
$original_name = $_FILES["upload"]["name"];
$temporary_name = $_FILES["upload"]["tmp_name"];
$target = "/var/www/html/images/" . $original_name;
if(move_uploaded_file($temporary_name, $target)) {echo "Success";}
else{echo "Failed";}
?>
Original File, Temporary File, and Target are properly set. However, Failed is returned.
Adding the following to Stage2.php returns 0. To quote the PHP Manual, 0 means "There is no error, the file uploaded with success."
$_FILES["upload"]["error"];
Adding the following to Stage2.php does not display any errors. This leads me to suspect that PHP thinks that everything is OK, and perhaps the problem is some issue with CentOS or Nginx. Is this the logical assumption?
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
For debugging, in CentOS, I've set the permissions of /tmp and /var/www/html/images to 777 (read, write, execute for everybody). Still no errors are returned.

