javascriptresume-uploadtus

Uppy IO Resume-able File Upload allowedFileTypes


I'm using Uppy.io v0.23.1 for resumeable file uploads.

As per documentation, we can limit file types through allowedFileTypes property.

Here is my code in effort to limit file uploader control to only allow MS PowerPoint files:

var uppy = new Uppy.Core({
    debug: true, autoProceed: false, restrictions: {
        maxFileSize: 100000,            
        allowedFileTypes: ['.pptx']
    } });
uppy.use(Uppy.Dashboard, {
    trigger: '.UppyModalOpenerBtn',
    inline: true,
    target: '.DashboardContainer'


});

Error: You can only upload: .pptx

Note: Setting mime type like ['application/zip'] accepts PPTX files but it also allows ZIP files as well. Also tried application/vnd.openxmlformats-officedocument.presentationml.presentation as mime type for PPTX. But this doesn't even allow PPTX files.

Any solution or workaround would be highly appreciated.


Solution

  • An issue was created on GitHub as well.

    Member of repository suggested that...

    0.23 is a very old version that doesn't support extensions at all, only mime types. Extension support was added in a 0.25.x version. You would need to update (ideally to 0.30 if possible) to be able to use allowedFileTypes: ['.ext']