Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to upload file using RpcManager and formData?

    Hi

    I want to upload file using RpcManager and formData but it doesn't send values of formData.

    Code:
    isc.FanavarRPCManager.sendRequest({
    contentType:"multipart/form-data",
    useSimpleHttp :true,
    actionURL: Url,
    httpMethod : "POST",
    showPrompt:true,
    data:formData,
    callback: function(data){
    console.log(data)
    }
    });








    #2
    What is "formData"? What did you use to represent the file, HTML5 File objects?

    Comment


      #3
      I'm using free edition of smartclient , so I can't upload file with a DynamicForm and datasource.
      I get items of Dynamic form and append them into a formData.

      Code:
      this.BBBConfigForm = isc.DynamicForm.create({ height: "100%",
      width: "100%",
      autoDraw: false,
      titleWidth:"200",
      padding:"10",
      readOnlyDisplay:'disabled',
      fields: [
      {name: 'app_name',width:"100%",title:Message.BBB_App_Name},
      {name: 'client_title',width:"100%",title:Message.BBB_Client_Title},
      {name: 'default_presentation',width:"100%",title:Message.BBB_Default_Presentation_File,type: "UploadItem", multiple: false,accept:".pdf"},
      {name: 'favicon',width:"100%",title:Message.BBB_Fav_Icon,type: "UploadItem", multiple: false,accept:".ico"},
      ]
       });
      let formData=new FormData();
      root.BBBConfigForm.getItems().forEach(item=>formData.append(item.name,item.getValue()));
      if(root.BBBConfigForm.getItem("default_presentation").getValue()!=undefined)
            formData.append('default_presentation',document.getElementById(root.BBBConfigForm.getItem('default_presentation').getElement().id).files[0]);
      if(root.BBBConfigForm.getItem("favicon").getValue()!=undefined)
          formData.append('favicon',document.getElementById(root.BBBConfigForm.getItem('favicon').getElement().id).files[0]);
      Last edited by Hossein.Asadzadeh@gmail.com; 29 May 2022, 04:11.

      Comment


        #4
        ? :rolleyes:

        Comment

        Working...
        X