0

I've been working with the filepicker api for the past day or so - trying to wrap my head around mimetype validation when using the pick method. I'd like to only support uploading epub files, which have the mimetype : 'application/epub+zip'. However, whenever I use this as the only supported mimetype in filepicker, I get the following error :

The page can only support a application/epub zip/*

It seems to be interpreting the '+' inside of the string as a space. Any advice on how to fix this, or validate epub files properly would be appreciated!

Edit : I found a way around this by using 'extension' instead - and adding {extension : '.epub'}. This will work, as I can just set the maxSize to be some reasonable number, and perform some validation server-side (and deleting the file from s3 if it isn't actually an epub). If someone figures out how to do it properly with the mimetype that would be awesome though!

Andro Selva
  • 53,910
  • 52
  • 193
  • 240
laxman
  • 1
  • 1

1 Answers1

0

Glad you got it to work with extension, one way with mimetype might be to urlencode the + to be %2B

brettcvz
  • 2,371
  • 1
  • 13
  • 14