Uint8Array, Uint16Array, Uin32Array, Blob to System.FileDocument

0
Hi I need the client function to store Uint8Array, Uint16Array, Uin32Array, Blob into a context object of type System.FileDocument or generalizations
asked
2 answers
0

Hi Ockert,

You would need to create a java action to accomplish what you want to do. Have you seen this question? Laith's reply to the second answer outlines what you could do. 

You would have to figure out how to convert those file types to a java.io.InputStream in order to use storeFileDocumentContent.

 

 

Here is a link to the API docs.

https://apidocs.mendix.com/7/runtime/

 

Hope this helps!

answered
0

Ended up using something like this

 

_html2canvas(document.body).then(
 lang.hitch(
  this,
  function(canvas) {
   canvas.toBlob(
    lang.hitch(
     this,
     function(blob){
      var formData=new FormData();
      var dataPart={"changes":{},"objects":[]};
      formData.append("data",JSON.stringify(dataPart));
      formData.append("blob",blob);
      dojo.xhrPost(
       {
        url:'/file?guid='+this._contextObj._guid+'',
        postData:formData,
        headers:{
         "X-Csrf-Token": mx.session.getConfig("csrftoken"),
         "X-Requested-With": "XMLHttpRequest"
        }
       }
      );
     },
    ),
    'image/png'		// fmt 
			// q
   );
  }
 )
);

 

answered