Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

XSJS - How to identify type of file uploaded through FileUploader

$
0
0

Hi,

 

     I am uploading a file using SAP UI5 FileUploader. In an Ajax call, I'm sending the file to server. ContentType is not set for ajax call. Because user can upload either XML or zip file. Now, How do I get ContentType in xsjs. It comes undefined.

 

This is the code snippet,

 

var oSimpleFileUploader = this.getView().byId("oSimpleFileUploader");

var fd = jQuery.sap.domById(oSimpleFileUploader.getId() + "-fu").files[0];

var uploadURL = oSimpleFileUploader.getUploadUrl();

 

$.ajax({

            url: uploadURL,

            type: "POST",

            dataType: "json",

            data: fd,

            processData: false,

            beforeSend: function(xhr) {

                xhr.setRequestHeader("X-CSRF-Token", CSRFToken);

            },

            success: function(ret) {

               

            },

            error: function(body, status, xhr) {

            }

        });

 

How to get the uploaded file type so that I can process accordingly?


Viewing all articles
Browse latest Browse all 6412

Trending Articles



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