Question T5466
Visible to All Users

Would it be possible to add another prop on the options.callback similar to content for saving an object of info returned from the server?

created 4 years ago (modified 4 years ago)

[Ticket cloned from T2377: onUploadFiles with Dynamic Panels]

If i save an object on the content prop it results in an error when the survey loads, which i opened a bug here: https://github.com/surveyjs/survey-library/issues/2373

I'm not using the onDownloadFile event in my case, we are calling azure storage directly.

Edit: I should point out we are not using the built in surveyjs file preview, but a custom vue component is it's place, hence why i need to save extra info on the content prop for cropping/thumbs/download path/etc.


MRheault

Oct 14, 2020 9:13 PM

Would it be possible to add another prop on the options.callback similar to content for saving an object of info returned from the server? for example:

JavaScript
fileName: "afddaec1-3d26-4064-a82e-9420cc301118_xyz.jpg" fileSas: "?sv=xyz" fileSize: 377059 fileType: "image/jpeg" storageAccount: 1 thumbFileName: "afddaec1-3d26-4064-a82e-9420cc301118_xyz.jpg" thumbFileSas: "?sv=xyz"

I'm currently saving it on the content prop and it breaks some stuff since it's expecting a string

ST

Serge T Sergey T

Oct 15, 2020 6:03 AM

Hello,
You can return any object in the content property, but in this case you should handle the https://surveyjs.io/Documentation/Library?id=surveymodel#onDownloadFile event as shown in this sample - https://surveyjs.io/Examples/Library/?id=questiontype-file
Thanks, Serge
SurveyJS Team

M

MRheault

Oct 15, 2020 3:38 PM (modified 3 minutes ago)

If i save an object on the content prop it results in an error when the survey loads, which i opened a bug here: https://github.com/surveyjs/survey-library/issues/2373
I'm not using the onDownloadFile event in my case, we are calling azure storage directly.
Edit: I should point out we are not using the built in surveyjs file preview, but a custom vue component is it's place, hence why i need to save extra info on the content prop for cropping/thumbs/download path/etc.

ST

Serge T Sergey T

Oct 15, 2020 3:59 PM

Hello,

If i save an object on the content prop it results in an error when the survey loads

Yes, because by default SurveyJS library treats content as base64 encoded string or an image URL

I'm not using the onDownloadFile method in my case, we are calling azure storage directly.

If you store custom object or custom string in file content, you need to process this content in the https://surveyjs.io/Documentation/Library?id=surveymodel#onDownloadFile event hander.
If would be nice to see working sample illustrating your question. And we need to extract your question into a separate thread.
Thanks, Serge
SurveyJS Team

Comments (1)

    Hello,

    Let's discuss this issue in this separate thread.

    Thanks, Serge
    SurveyJS Team