Closed blsn closed 6 years ago
list($files, $headers) = $fileUpload->processAll();
foreach($files as $file) {
//Regardless of the validation status - failed or not you do this
echo $file->getFilename();
}
$file->name
should also get you there
This will work only as follows:
foreach($files as $file) {
if ($file->completed) { // check if the upload was completed
echo $file->getFilename();
}
}
But how can I get the file names for both completed/uncompleted?
list($files, $headers) = $fileupload->processAll();
echo json_encode(['files' => $files]);
Two files were uploaded. file name visible only for validation file error:
{"files":[{"error":"Filetype not allowed","errorCode":0,"completed":false,"name":"header-image.jpg","size":72193},{"error":0,"errorCode":0,"completed":true,"size":2254}]}
How to get the file name?