filestack / filestack-js

Official Javascript SDK for the Filestack API and content ingestion system.
https://www.filestack.com
MIT License
206 stars 77 forks source link

Unsupported input file type - Example fiddle throwing error #404

Closed cannikin closed 3 years ago

cannikin commented 3 years ago

I'm trying to use the SDK to upload some files using the example code in the official example fiddle here: https://jsfiddle.net/gh/get/library/pure/filestack/filestack-js/tree/master/examples/upload

When I try to call client.upload() in my app I'm getting the error "Unsupported input file type". I figured it was just me, but trying to upload in the fiddle above throws the same error!

Maybe the SDK got updated at some point but the code samples didn't?

cannikin commented 3 years ago

It appears that upload() doesn't accept an array of files (or a FileList), only a single file. Changing the code to:

client.upload(files[0], { onProgress }, {}, token)

This worked in my own code, but making the same change in the fiddle still throws an error. 🤷‍♂️