Sofia Gardiner

Sofia Gardiner


How to Multiple File Upload in Angular 9

Hello all! In this article, we will talk about Angular 9 multiple file upload example. I explained simply about Angular 9 reactive form multiple file upload. Here you will learn Angular 9 file upload multiple files. This article goes in detailed on multiple file upload in Angular 9.

Follow bellow tutorial step of Angular 9 multiple file upload component.

I explain step by step multiple file upload with angular 9 application. I already written more tutorial about file upload as like bellow:

File Uploading with Angular 9

Image Uploading with Angular 9

Multiple Image Uploading with Angular 9

In this example, i want to share with you how to multiple file upload with form data in Angular 9. We will see example of Angular 9 reactive form multiple file upload. We will use reactive form with multiple file upload in angular 9 step by step. I also created api for store file in folder using php for angular 9 multiple file upload.

Here, we will simple create reactive form using formGroup. input file onchange event we will add file to another formgroup element. then after click on submit button we will call web api for store that file to server.

I written step by step multiple file uploading with Angular 9 application, also created web services using php. so let’s follow bellowing step and get preview like as bellow:

Step 1: Create New App

You can easily create your angular app using bellow command:

ng new my-new-app

Step 2: Import Module

In this step, we need to import HttpClientModule, FormsModule and ReactiveFormsModule to app.module.ts file. so let’s import it as like bellow:


import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
  declarations: [
  imports: [
  providers: [],
  bootstrap: [AppComponent]
export class AppModule { }

Step 3: Updated View File

Now here, we will updated our html file. we will create simple reactive form with input file element.

In this file i used bootstrap 4 class, if you want to use bootstrap then you can follow this link: Install Bootstrap 4 in Angular 9

so let’s put bellow code:


<h1>Angular 9 Multiple File Upload Example -</h1>
<form [formGroup]="myForm" (ngSubmit)="submit()">
    <div class="form-group">
        <label for="name">Name</label>
        <div *ngIf=" &&" class="alert alert-danger">
            <div *ngIf="">Name is required.</div>
            <div *ngIf="">Name should be 3 character.</div>
    <div class="form-group">
        <label for="file">File</label>
        <div *ngIf="f.file.touched && f.file.invalid" class="alert alert-danger">
            <div *ngIf="f.file.errors.required">File is required.</div>
    <button class="btn btn-primary" type="submit">Submit</button>

Step 4: Use Component ts File

Now we need to update our component.ts file with formGroup and formControl element.

i used my local api file url ‘http://localhost:8001/upload.php’, you can use your api there.

so, let’s update as like bellow:


import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { FormGroup, FormControl, Validators} from '@angular/forms';
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
export class AppComponent {
   myFiles:string [] = [];
   myForm = new FormGroup({
    name: new FormControl('', [Validators.required, Validators.minLength(3)]),
    file: new FormControl('', [Validators.required])
  constructor(private http: HttpClient) { }
  get f(){
    return this.myForm.controls;
  onFileChange(event) {
        for (var i = 0; i <; i++) { 
    const formData = new FormData();
    for (var i = 0; i < this.myFiles.length; i++) { 
      formData.append("file[]", this.myFiles[i]);
    }'http://localhost:8001/upload.php', formData)
      .subscribe(res => {
        alert('Uploaded Successfully.');

Now we are ready to run our example, we will create api file using php. so you can create update.php file with “upload” folder and run with different port and call it. so let’s create upload.php file as like bellow:


    header("Access-Control-Allow-Origin: *");
    header("Access-Control-Allow-Methods: PUT, GET, POST");
    header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
    $folderPath = "upload/";
    $file_names = $_FILES["file"]["name"];
    for ($i = 0; $i < count($file_names); $i++) {
        $extension = end(explode(".", $file_name));
        $original_file_name = pathinfo($file_name, PATHINFO_FILENAME);
        $file_url = $original_file_name . "-" . date("YmdHis") . "." . $extension;
        move_uploaded_file($_FILES["file"]["tmp_name"][$i], $folderPath . $file_url);

Now we are ready to run both:

Run Angular App:

ng serve


php -S localhost:8001

Now you can run and check it.

I hope it can help you…

#angular #webdev #javascript

What is GEEK

Buddha Community

How to Multiple File Upload in Angular 9

I am Developer


Multiple File Upload in Laravel 7, 6

in this post, i will show you easy steps for multiple file upload in laravel 7, 6.

As well as how to validate file type, size before uploading to database in laravel.

Laravel 7/6 Multiple File Upload

You can easily upload multiple file with validation in laravel application using the following steps:

  1. Download Laravel Fresh New Setup
  2. Setup Database Credentials
  3. Generate Migration & Model For File
  4. Make Route For File uploading
  5. Create File Controller & Methods
  6. Create Multiple File Blade View
  7. Run Development Server

#laravel multiple file upload validation #multiple file upload in laravel 7 #multiple file upload in laravel 6 #upload multiple files laravel 7 #upload multiple files in laravel 6 #upload multiple files php laravel

I am Developer


Ajax Multiple Image Upload with Progress bar with jQuery in Laravel

In this post, i will show you, how you can upload multiple file with progress bar in laravel using jQuery ajax.

So follow below given steps to create ajax multiple image upload with progress bar with jquery and laravel php.

Multiple File Upload with Progress bar Using jQuery and Laravel PHP

Now follow the below given simple and easy step to upload multiple file with progress bar in laravel using jQuery ajax:

  • Step 1: Download Laravel App
  • Step 2: Add Database Details
  • Step 3: Create Migration & Model
  • Step 4: Add Routes For Multiple File Upload
  • Step 5: Create Controller by Artisan
  • Step 6: Create Blade View
  • Step 7: Run Development Server

#multiple file upload with progress bar using jquery and laravel #laravel multiple file upload ajax with progress bar #how to upload multiple images with progress bar in laravel #laravel 7 multiple image upload example #image upload with progress bar laravel #laravel multiple image upload ajax

I am Developer


Laravel 7 Multiple Image Upload with Preview

Here, i will show you how to upload multiple image with preview using ajax in laravel.

Laravel 7 Ajax Multiple Image Upload with Preview

Just follow the below steps and upload multiple images using ajax with showing preview in laravel applications:

  • Install Laravel Fresh Setup
  • Setup Database Credentials
  • Create Route
  • Generate Controller By Command
  • Create the blade view
  • Start Development Server

#laravel multiple image upload with preview #laravel multiple image validation #display multiple images in laravel #laravel multiple file upload #multiple image upload in laravel 6 #ajax image upload and preview with laravel

I am Developer


Dropzone Multiple File Upload Laravel 7

Dropzone multiple image file upload laravel. Here i will show you how to upload multiple image file using dropzone js in laravel.

Also i will show you how you can drag and drop multiple image file with dropzone js in laravel.

The dropzone js is multiple file upload plugin for laravel and other programming languages.

Laravel Multiple Image File Upload Using Dropzone js

So, Upload multiple image file using dropzone js in laravel with below steps:

  1. Install Laravel App
  2. Setup Database Credentials in .env
  3. Create Route
  4. Generate a Controller & Model
  5. Create a View File
  6. Start Development Server

#laravel dropzone multiple files #multiple file upload plugin laravel #multiple image upload with dropzone.js in laravel #dropzone multiple image upload laravel

I am Developer


Drag and Drop file upload using Dropzone in Laravel 8

Laravel 8 drag and drop multiple file upload dropzone js laravel 8 dropzone example. In this tutorial, you will learn, laravel 8 dropzone multiple files. OR understand the concept of laravel 8 dropzone image file upload.

And learn how to upload multiple image file without refresh or reload the whole web page using dropzone js in laravel 8 app.

Note that, Dropzone.js is a jquery plugin, dropzone.js through you can select one by one image and also with preview. After choose image from browse you can see preview of image. dropzone.js also provide filter like we can make validation for max upload, specific image or file extension etc.

In this example tutorial, we will create two routes, one for display dropzone image upload form view and another for store image file. Then, create two methods on DropzoneController.

Drag & Drop File Uploading using Laravel 8 Dropzone JS

Step 1 – Download Laravel 8 Application
Step 2 – Setup Database with App
Step 3 – Create Model & Migration
Step 4 – Create Routes
Step 5 – Generate Controller By Artisan Command
Step 6 – Create Blade View
Step 7 – Implement javascript Code for Dropzone Configuration
Step 8 – Create Images Directory inside Public Directory
Step 9 – Run Development Server

#dropzone multiple file upload laravel 8 #dropzone multiple image upload laravel 8 #multiple image upload with dropzone.js in laravel 8 #laravel 8 dropzone js multiple file upload