cancel
Showing results for 
Search instead for 
Did you mean: 

Need to read the files from local or remote URL in XSJS.

Former Member
0 Kudos

Hi Experts,

I hope you all are doing good. I am new to SAP HANA development. I have a requirement such as i have to read the different format files such as image, video and pdf etc..from XSJS file. All these files need to be read from one local URL(Eg: D:\test.jpg). From the UI i can able to read these files by uploading through fileuploader 'sap.ui.commons.FileUploader '. How to pass the file patch or URL of file to be upload to XSJS.

Could you please help me in this. I have some urgent task to be complete..

Please help me in this task. Thank you very much in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

SergioG_TX
Active Contributor
0 Kudos

Kishore,

are you building a sapui5 app? if so.. then the file uploader documentation from the sdk will guide u thru the steps. what happens there uis that the file content will get posted to your xsjs service.

if you need to call a service from xsjs.. then you need to set up a destination and a service using that destionation. check out outbound connectivity for those details

Former Member
0 Kudos

Hi Sergoi,

Thanks a lot for your quick response. Yes I am building the UI5 application. In this application, I have to upload some files  from a particular local system location through a function call which will be calling when the user is logged in to the application first time. So i am thinking to pass/select  the URL of the file to be upload from XSJS and from here i will save my files to database. In this case the files are constant always. Currently this is i am doing from UI through File upload. But now i do not want do from UI. I am passing file to XSJS as '$.request.entities' but now i have pass some local folder location like "D:\testfolder\test.jpg" instead. Could you please share any code if you have any ? then it would be very much helpful to me.

SergioG_TX
Active Contributor
0 Kudos

Kishore,

I do not think that a direct file upload would be possible. The file uploader gets the body of the file only. I am not sure if saving the file in the db would be your best approach... are these only text files? I believe that a better approach would be to save files to a file system but i have not done that becauise that would be a security risk from a location (remote / url) into a HANA file system plus you would need additional system privileges.

for code samples, please check the sapui5 sdk

https://sapui5.netweaver.ondemand.com/#test-resources/sap/ui/commons/demokit/FileUploader.html

Former Member
0 Kudos

Sergio,

Thanks again for your response. I gone through some functions or parameters from the above mentioned URL. But my requirement has not fulfilled. Could you please let me know how to use the

below function in upload. It's a great help for me if you provide sample on this function. Because i don't know how to declare or use this function in my code. Thanks again.

     setUploadUrl(sUploadUrl) : sap.ui.unified.FileUploader