want to do file upload but not to get file content as base64 so trying to do the onFileupload Method for that i need this storeDataAsText how to do this in designer
How to Add storeDataAsText to false using designer while creating a survey form
Answers approved by surveyjs Support
Hello,
By default, the File question's storeDataAsText
property is unavailable in a SurveyJS Creator because it is required to attach the survey.onUploadFiles
function.
If you wish to upload files to a server and allow users configure this in a survey creator, please follow these steps:
- Make the File question's
storeDataAsText
property visible.
JavaScriptimport { Serializer } from "survey-core";
Serializer.getProperty("file", "storeDataAsText").visible = true;
- Now, to allow a survey to upload files to a specified storage, implement the
SurveyModel
'sonUploadFiles
event and upload files to a specified storage. In a survey creator, you can access the previewed survey using thecreator.onSurveyInstanceCreated
function.
JavaScriptcreator.onSurveyInstanceCreated.add((sender, options) => {
if(options.reason === 'test'){
const survey = options.survey;
survey.onUploadFiles.add(() => {
//...
});
}
});
Please let me know if you have any further questions.