SAPUI5 FileUploader:无法找到文件并将其附加到 FormData()

SAPUI5 FileUploader: Cannot find and append file to FormData()

如何使用文件上传器访问我 select 的文件?

欢迎任何解决方案。

var oInput = new sap.m.Input();  
var oFileUploader = new sap.ui.unified.FileUploader();

var oButton = new sap.m.Button({
text: "Send data",
press: function(){

    var oFormData = new FormData();

    oFormData.append("myTitle", oInput.getValue());
    oFormData.append("myFile", ****This is where I want to insert my file****);

    var xhr = new XMLHttpRequest;
      xhr.open('POST', 'www.myUrl.com/foo/bar', true);
      xhr.send(oFormData);

}
});

自己找到答案:

oFileUploader.setUploadOnChange(true);

    var oFormData = new FormData();

    oFormData.append("title", "I am the title");

    jQuery.sap.domById(oFileUploader.getId() + "-fu").setAttribute("type", "file");
    oFormData.append("document", jQuery.sap.domById(oFileUploader.getId() + "-fu").files[0]);

    jQuery.ajax( {
      url: "www.myWebsite.com/path",
      data: oFormData,
      cache: false,
      contentType: false,
      processData: false,
      type: 'POST',
      success: function(data) {

      },
      error: function() {

      }
    });