// Grab the fileUploads array and see what's there
// If this POST was not multi-part, then this array will be empty
if let uploads = request.postFileUploads, uploads.count > 0 {
// Create an array of dictionaries which will show what was uploaded
var ary = [[String:Any]]()
for upload in uploads {
ary.append([
"fieldName": upload.fieldName,
"contentType": upload.contentType,
"fileName": upload.fileName,
"fileSize": upload.fileSize,
"tmpFileName": upload.tmpFileName
])
}
values["files"] = ary
values["count"] = ary.count
}

As demonstrated above, the file(s) uploaded are represented by the request.postFileUploads array, and the various properties such as fileName, fileSize and tmpFileName can be accessed from each array component.

Note: The files uploaded are placed in a temporary directory. It is your responsibility to move them into the desired location.

So let's create a directory to hold the uploaded files. This directory is outside of the webroot directory for security reasons: