Open ryancschulz opened 3 years ago
Happy to see this - was going a bit mad kicking it around. Of note, params like "maxFiles" work and produce an error message.
I'm experiencing the same issue, users can drag and drop files with mime types that are not accepted. I was able to work around it by implementing the onFileSelected
callback and throwing an exception when a file's mime type is not supported, the error's message is shown in the filepicker modal
var supportedTypes = [
'image/jpeg',
'image/png'
];
filestackClient.picker({
accept: supportedTypes,
onFileSelected: function(file) {
if (!supportedTypes.includes(file.mimetype)) {
throw new Error("Unsupported file type '" + file.mimetype + "'.");
}
},
// Other settings
}).open()
It appears the file type 'accept' parameters are not being respected when a user drags a file into picker from file browser on local machine. Is there a way to handle this so those files can be rejected when drag and dropped? It works correctly when user selects via picker.