Uploading Word Documents (.docx/.docx)

I have been trying to upload .docx files using UploadThing. I used the following configuration:
bookUploader: f({
"application/msword": {
maxFileSize: "4MB",
maxFileCount: 1,
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": {
maxFileSize: "4MB",
maxFileCount: 1,
},
})
.middleware(({ req }) => auth(req))
.onUploadComplete(async ({ file }) => console.log("FILE URL: ", file.url)),
bookUploader: f({
"application/msword": {
maxFileSize: "4MB",
maxFileCount: 1,
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": {
maxFileSize: "4MB",
maxFileCount: 1,
},
})
.middleware(({ req }) => auth(req))
.onUploadComplete(async ({ file }) => console.log("FILE URL: ", file.url)),
The drag and drop functionality works perfectly, but showOpenFilePicker has been giving me the following error on Chrome: TypeError: Failed to execute 'showOpenFilePicker' on 'Window': Invalid type: application/msword/* This problem is only happening with the click to upload button in UploadDropzone, the UploadButton is working perfectly for some reason. Any ideas on what can be done to solve this?
Solution:
However, 5.2.0 is broken within the pages router, so if you're using the pages router, you'll have to use the 5.2.1 canary version, here: https://discord.com/channels/966627436387266600/1102510616326967306/1130159006292389898...
Jump to solution
3 Replies
astrid
astrid17mo ago
Hey! There was a bug which led to uploadthing generating invalid mime types, this was fixed in 5.2.0 :)
Solution
astrid
astrid17mo ago
However, 5.2.0 is broken within the pages router, so if you're using the pages router, you'll have to use the 5.2.1 canary version, here: https://discord.com/channels/966627436387266600/1102510616326967306/1130159006292389898
Prannay
PrannayOP17mo ago
Thank you! That worked perfectly.
Want results from more Discord servers?
Add your server