wp.media add context

I have wp.media frame on my plugin to upload doc, docx file. I am filtering the uploaded file.
If uploaded other than supported file, it will display this error
Unsupported file upload

I am filtering it at wp_handle_upload_prefilter to check for supported file

However this filter will affect all other media uploader as well.
I think, if it is possible to add context to media uploader, i could check weather to filter or not.

EDIT 1:
My barebone js code to

// Create the media frame.
    doc_uploader = wp.media.frames.file_frame = wp.media({
        title: "Select Documents",
        button: {
            text: "Select Documents"
        },
        library : {
          type: accepted_mime_types
        },
        multiple: true  // Set to true to allow multiple files to be selected
    });

0

Leave a Comment