Skip to Content

Image Classification with SAPUI5


I was following tutorial on Image Classification with SAPUI5 .

Link :

Response message: "Wrong request: No file sent in the request, please set the field 'files'"

Controller Code :

var headers = new Headers();
headers.append("Content-Type", "multipart/form-data");
headers.append("accepts", "application/json");
headers.append("APIKey", '<API_KEY>');
headers.append("DataServiceVersion", "2.0");
var files = $("#files")[0].files; // get files
var file = files[0]; // Get single Image file from files
var formData = new FormData(); // Create new formData Object
window.console.log("File selected",;
formData.append("files", file,; // add image file into formdata
fetch("/ml-dest", {
headers: headers,
method: 'POST',
body: formData})
.then( function (response) { return response.json(); })
.then(function (data) { window.console.log(data); });

Note : I also tried custom XHR, SAPUI5 fileUploader got same error.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Posted on Mar 05, 2019 at 08:22 AM

    Hi Harsh,

    I've seen this error before. Unfortunately, it is somehow incorrect / not very precise and it simply means "we cannot parse your request successfully". This could also be related due to incorrect header information etc.

    You only need to set the "Authorization" header (to "Bearer KEY") and the rest should be fine.

    I'm not familiar with the fetch API, but maybe this StackOverflow question can guide you to the right solution.

    PS: Please don't use this in productive UI apps since your KEY can be stolen by anyone



    Add comment
    10|10000 characters needed characters exceeded