Upload Files: Small files are being uploaded incorrectly to S3 & DO Spaces
The problem
Uploading files following the instructions of the official documentation works except for when uploading very small files it seems. I have an audio file thats 7kb and uploading it shows a file with no filesize.
I initially read the DO documentation for spaces and they advised not uploading small files, i initially thought this was the issue. However I managed to use DO with another project i had set up from before and managed to upload the same files using multer and they worked as expected.
Just want to know if this is intentional or not and also how I get past this as I genuinely love developing with Adonis and don't want to use anything else!
Package version
@adonisjs/core : ^5.8.5 @adonisjs/drive-s3 : ^1.3.1
Node.js and npm version
Node: v16.11.1 Npm: v8.1.3
Sample Code (to reproduce the issue)
Controller:
export default class FilesController {
public async upload({ request, response }) {
const file = request.file('files');
await file.moveToDisk('./', {
name: `${uuidv4()}.${file.extname}`,
});
return file;
}
}
Everything else in the repo is standard following the documentation here: https://docs.adonisjs.com/guides/file-uploads
This issue seems to be present among a few users too: https://www.loom.com/share/f2e32e9de63846b7a77a702baed595c7 In the video taken from the adonis discord channel the user shows the exact problem, although the user didn't set the file extension (Which has already been address in DC chat), the results are still the same.