Closed hypo-thesis closed 1 year ago
Hi, I think you need to call req.files.fileUpload
instead of req.files.sampleFile
this because maybe the name of the input(file) is "fileUpload" and not "sampleFile".
Here is the example what I get when calling console.log(req.files)
[Object: null prototype] {
sampleFile: {
name: '12in23.txt',
data: <Buffer 31 32 20 64 69 66 66 65 72 65 6e 74 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 73 20 69 6e 20 32 30 32 33 2e 0d 0a 0d 0a 31 2e 20 ... 104 more bytes>,
size: 154,
encoding: '7bit',
tempFilePath: '',
truncated: false,
mimetype: 'text/plain',
md5: 'fb00791bb6bd75b9c88826ac963e2b7f',
mv: [Function: mv]
}
}
I am using the sample from the docs. I am on node 19.0.1 and I get
as my req.files and yet req.files.sampleFile is coming back as undefined. I cannot write it on the hdd and no error is coming back. What should I do?