I want to upload images or multiple different file types, like .pdf, .doc and .jpg
By default, the file type is mimetype: 'application/octet-stream'.
Even if I set contentType: ContentType('image', 'jpeg') in options, application/octet-stream gets saved as content-type.
How can I set the content type of the uploaded files automatically to the right content type.
All file upload plugins I have been using for web and mobile development, could get the right content type from the file and I did not need to set it manually.
Am I missing something?
UploadFileInfo(file, fileName, contentType: ContentType('image', 'jpeg'))
I used package:mime/mime.dart to get the mime type of the file and then inserted it into UploadFileInfo, like you suggested.
what is content type for pdf and documents
what is content type for pdf and documents
"application/pdf"
Most helpful comment