FamilySearch/fs-js-lite

Support uploading files for creating memories

Opened this issue · 0 comments

FormData makes it really easy to upload files. In the body processing middleware we just need to detect FormData objects and do nothing (don't even set the Content-Type header) so that it gets passed straight to XHR which will correctly process the FormData. Just need to instruct tell users how to properly setup the FormData.

var formData = new FormData();
// Name must be artifact otherwise the API will return a 400
formData.append('artifact', fileBlob);

Are there other usecases we need to support where a blob isn't available?