surveyjs / survey-library

Free JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout.
https://surveyjs.io/form-library
MIT License
4.13k stars 804 forks source link

file.content.substr is not a function #2373

Open mrheault opened 4 years ago

mrheault commented 4 years ago

Are you requesting a feature, reporting a bug or asking a question?

Bug

What is the current behavior?

Error is thrown when saving object instead of string on file.content during upload callback.

What is the expected behavior?

File.content should allow for more than just a string to save info returned from the server. isFileImage() should have a type check before calling .substr()

How would you reproduce the current behavior (if this is a bug)?

On file upload store an object instead of a string on file.content options.callback( 'success', [file].map((file) => { return { file, content: response.data.value }; })

Specify your

andrewtelnov commented 4 years ago

@mrheault We are expecting file content here, base64 string.

Thank you, Andrew

SaraaAwwad commented 4 years ago

Can you make it clearer on how to fix this issue please? If the input could be illustrated with an example it would be better. Currently I convert to base64, however anything beside images doesnt appear.