I've setup an Angular based file upload using the ng-file-upload plugin (https://github.com/danialfarid/ng-file-upload) and I've been handling the file upload with a PHP script.
The file upload and script work on smaller files (tested it on < 1MB), but fails on a larger file (9MB). This leads me to believe that there's a file upload issue. However, I've already created a .user.ini file in the /wwwroot folder with a single line:
upload_max_filesize=20M
Is there another reason why the $_FILES and $_POST arrays would be empty?
JS Code:
Upload.upload({
url: '/scripts/receiveFile.php',
file: file
}).then(function(resp) {
console.log(resp.data);
}, function(resp) {
console.log(resp.data);
}, function(evt) {
var progressPercent = parseInt(100.0 * evt.loaded / evt.total);
console.log(progressPercent + "%");
});
HTML Code:
<div>
<h1>Upload</h1>
<input type="file" accept=".zip" ngf-select="submitFile($file)"></input>
</div>
PHP Code:
$file_name = basename($_FILES['file']['name']);
$file_tmp_name = $_FILES['file']['tmp_name'];
The script fails because 'file' is undefined in the $_FILES array - because the $_FILES array is empty.
Thanks!