I get a $tmp_name of "/tmp/phpv1K2Eh" but I can't move the temporary file to the "uploads/" folder.
This worked fine on my prior server, but on my new AWS server I guess I need permissions to write to the folder?
<?php
$name = $_FILES['file']['name'];
$tmp_name = $_FILES['file']['tmp_name'];
if(isset($name) && !empty($name)){
$location = 'uploads/' .$name;
if(move_uploaded_file($tmp_name, $location)){
echo 'File Uploaded!';
} else {
echo 'Error in upload';
}
}
?>
<form action="test.php" method="POST" enctype="multipart/form-data">
<input type="file" name="file"><br><br>
<input type="submit" name="Submit">
</form>
EDIT: Needed to grant upload permissions to the folder. But how do I do this for all folders and subfolders in /var/www?
$ sudo chown apache:apache /var/www/html/uploads/