Manage Image Uploads
Survey authors can use the Image and Image Picker question types to add images to a form or questionnaire. Images are embedded in the survey JSON schema as Base64 URLs. However, this technique increases the schema size. To avoid this, you can upload images to a server and save only image links in the JSON schema, as shown in this demo. Read more...
Survey authors can use the Image and Image Picker question types to add images to a form or questionnaire. Images are embedded in the survey JSON schema as Base64 URLs. However, this technique increases the schema size. To avoid this, you can upload images to a server and save only image links in the JSON schema, as shown in this demo.
To implement image upload, handle the onUploadFile
event. Its options.files
parameter stores the images you should send to your server. Once the server responds with an image link, call the options.callback(status, imageLink)
method. Pass "success"
as the status
parameter and a link to the uploaded image as the imageLink
parameter.
In this demo, images are uploaded to SurveyJS servers from where they are then deleted after a predefined period of time. We strongly encourage you to use your own servers for image uploads when you use SurveyJS to collect sensitive respondent data in your application.