Quantcast
Channel: SCN: Message List - SAP HANA and In-Memory Computing
Viewing all articles
Browse latest Browse all 8968

Re: How to handle POST request in an xsjs file?

$
0
0

Hi Thomas,

 

I using the sap.ui.commons.FileUploader to send data to a XSJS, which should save the picture into a hana NCLOB column.

 

So far I can select for example a CSV-file with a string contained in it. It is getting posted to the db-table correctly. Until now did not manage to upload PNG-File.

 

Excerpt: Sending file via Fileloader.

------------------------------------------------------------

        var dataUrl = location.origin + "/SAPUI5onHANAapp/services/savePicture.xsjs";

        var oFileloader = Fileloader;

        var fileName = oFileloader.getValue();

        url = dataUrl + "?file_name=" + fileName;

 

        oFileloader.setUploadUrl(url);

        oFileloader.upload();

__________________________________

 

Excerpt: XSJS - get body as String

__________________________________

var file_body = $.request.entities[0].body.asString(); // -> will be inserted into db-table

 

__________________________________

 

Do you have any advice, what I need to enhance to save an image successfully to hana? I guess I need to enhance the $request handling. Here my code crashes, when trying to upload a PNG-File.

 

Thanks and best regards

Tom


Viewing all articles
Browse latest Browse all 8968

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>