How to upload large files using SAPUI5 FileUploader

4.5k views Asked by At

I am using the FileUploader in SAP WEB IDE to upload text files to SAP back end database through OData Services.

I am able to upload small files with size around 10-20 KB but my requirement is to be able to upload files with size 100-150 MB.

Code for FileUploader in controller:

var oFileUploader = this.getView().byId("fileUploader1");

oFileUploader.addHeaderParameter(new sap.ui.unified.FileUploaderParameter({
    name: "slug",
    value: oFileUploader.getValue()
}));
    
oFileUploader.addHeaderParameter(new sap.ui.unified.FileUploaderParameter({
    name: "x-csrf-token",
    value: data
}));
    
oFileUploader.setSendXHR(true);
oFileUploader.setUploadUrl(serviceUrl);
oFileUploader.upload();

alert("Upload Successful");

Code for XML View:

<Page title="{i18n>appDescription}" showNavButton="true" navButtonPress="onNavBack">
    <u:FileUploader
        id="fileUploader1"
        name="myFileUpload"
        uploadUrl=""
        uploadOnChange="false"
        width="400px"
        tooltip="Upload your file to the local server"
        uploadComplete="handleUploadComplete" />
    <Button
        text="Upload File"
        press="handleUploadPress" />
</Page>

For some time I see the status as pending and then failed: ERR_CONNECTION_RESET in the Network tab of browser console.

Note: I am able to upload same 101 MB text file into SAP back end system directly.

1

There are 1 answers

0
Boris Perlov On

There is a default limitation of 102400 KB on the HTTP server-side.

The limitation can be checked and changed through SMICM > go to Parameters.

Check the SAP official document before some changes : https://help.sap.com/docs/SAP_NETWEAVER_731/0c333adb55cd4dbf8e92a5175703224c/483e87b3ca6b72d0e10000000a42189c.html?locale=en-US&version=7.31.25