Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

surveyjs question type upload is not working #6

Open
bedinsky opened this issue Aug 23, 2018 · 0 comments
Open

surveyjs question type upload is not working #6

bedinsky opened this issue Aug 23, 2018 · 0 comments

Comments

@bedinsky
Copy link

Hi, did you ever tested a survey with a question type upload ?

The input field of type "file" is rendered in the ionic app (android and ios), it opens a filemanager but chosen image is not uploaded to surveyjs backend.

I think that the angular component Survey (from 'survey-angular') is not suited for an hybrid app.

File upload in ionic should be done using a cordova plugin file transfer
see https://ionicframework.com/docs/native/file-transfer/

Do you think it is possible override existing Javascript function in 'survey-angular.js' ?

    dxSurveyService.prototype.sendFile = function (postId, file, onSendFile) {
        var xhr = new XMLHttpRequest();
        xhr.onload = xhr.onerror = function () {
            if (!onSendFile)
                return;
            onSendFile(xhr.status == 200, JSON.parse(xhr.response));
        };
        xhr.open("POST", dxSurveyService.serviceUrl + '/upload/', true);
        var formData = new FormData();
        formData.append("file", file);
        formData.append("postId", postId);
        xhr.send(formData);
    };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant