cancel
Showing results for 
Search instead for 
Did you mean: 

How to post files to server using Upload Collection

0 Kudos
302
I tried fetching `uploaded files` from `UploadCollection` source as :
      var files = oEvent.getParameter("files"); 

Here i get a `fileList` type and then I have appended the same to `FormData` as

      var formData = new FormData();
      formData.append('file',files);

Is this the right approach if we need to send files as form-data to server ? If not please guide me the correct approach or format to append ... Even tried appending as an Array but no luck 😐 As the server side shown up few errors :

* Not a multi-part request

* Required request part 'file' is not present

If not as form-data and the same when i used `fileUploader` instead of `uploadCollection` and server side as `Python` * `fileUploader` has an attribute called `name` which can be used for rendering in server side as :

    `uploaded_files = request.files.getlist("file[]") # flask - python code for ref` 

and in UI5 - XML :

        <u:FileUploader
    id="fileUploader"
    name="file" ... 

This worked , But whereas when using `UploadCollection` it didn't as it has no such attribute and

what to consider on server side to fetch the same as `file[]` ?

Does it has any `name` attribute ?

I have gone through ui5 doc for ref but i couldn't find any attribute `name` Hope the Q is clear , any help is much appreciated .. Thanks

Accepted Solutions (0)

Answers (0)