How to upload multiple image with other information using form data in Angular

image upload multiple form-data Angular

How to upload multiple images with other information using form data in Angular
My request type

let body = {
    files: //here files array,
    message: //here json data 

Service method

return + 'addUpdate',body,{}).pipe();

Please provide me solutions

Solutions (1)
  • Ashish Pokle 1 year, 7 months, 1 week, 2 days, 13 hours, 7 minutes ago
    Look on the below Code, this will help you for upload multiple image in a ajax request

    this.documentList = [...]  //File Array
    this.baseApiUrl = '...'  // Your api path
    formData = FormData();
    // other information 
    this.formData.append("message", JSON.stringify(body));
    // add multiple files in a form data
    this.documentList.forEach(item => {
        this.formData.append("file", item)
    //  server api calling, body,{
        reportProgress: true

Your Answer To Login
Add Answer