Question T6408
Visible to All Users

Large images uploading issue

created 4 years ago (modified 4 years ago)

[Ticket cloned from T6375: Is there any way to add 'comment' type question when dragging 'text' question from toolbox in survey creator?]

Hi Andrew, I am stuck at image type in surveyjs creator. When the actual image width is more than 1200px; it is converting it into base64 string but returns 500 server error when calling a method on server side. Is there any particular restriction on image size or can we show a validation when user uploads an image in the creator which is more than 1200px width? Images less than 1200px width works fine.
Thanks a lot.

Comments (2)

    Hello,

    Could you clarify - what server (surveyjs.io or your own) are you using? What images are you talking about - file question content during run survey or static images selected in SurveyJS Creator during survey construction?

    Thanks, Serge
    SurveyJS Team

      Hi Serge,

      I am using my own server method and it's about static image type control selected in SurveyJS Creator. Any image which has original width more than 1200px is causing this issue. It converts in base64 but unable to call server side method. Please check the ajax code used for calling the method here.
      And I've attached an image which is 1909x160.

      JavaScript
      creator.toolbarItems .push({ id: 'save-test', visible: true, title: 'Save Assessment', action: function () { // json with base64 imagelink in creator.text here var obj = { questionStr: creator.text }; $.ajax({ type: "POST", url: "webform1.aspx/SaveQuestionJson", data: JSON.stringify(obj), contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) { alert(response.d) }, failure: function (response) { alert(response.d); } }); } });
      C#
      [System.Web.Services.WebMethod] public static string SaveQuestionJson(string questionStr) { return null; }

      Answers approved by surveyjs Support

      created 4 years ago

      Hello,

      You can use the onUploadFile event as discussed in this question - https://surveyjs.answerdesk.io/ticket/details/t6297

      Thanks, Serge
      SurveyJS Team

        created 4 years ago

        Hello,

        This question is not related to SurveyJS functionality. You need to check your server side application or web server settings.
        Here is the related article - https://stackoverflow.com/questions/2880722/can-http-post-be-limitless
        You can find your server configuration options in the appropriate documentation.

        Thanks, Serge
        SurveyJS Team

          Comments (1)

            Hi Serge, sorry for coming back to this a bit late again.

            I found out that there's no limit on post method that I am using here.
            To work it other way around, I want to know if there is a way in survey js creator for not converting the image in base64 format.
            What I want to achieve is in following order:

            1. Drag an image control from toolbox
            2. Select the image from anywhere in local file system
            3. Save it in particular application folder through custom function or whatever (when selecting).
            4. Image should get the image link path as "…/files/imageFolder/abc.png" (instead base64)
            5. Ultimately saving that physical path into DB.

            Or skip the part of saving an image in application folder, just stopping it to convert into base64.

            Appreciate your response.
            Thank you,
            Dhruv