Same file re upload not working

Topic: Same file re upload not working

When we are trying to upload same file again in file input, it is not posting to server. it works when we upload diff file and again select previous file. we need to upload same file multiple times.

Arkadiusz Idzikowski staff answered 3 years ago

We did not manage to add the fix in previous release, it should be ready for next one (16.09). There is a workaround you can use for now:

Add #uploader template variable to the input with type file in the component html template:

<input #uploader type="file" mdbFileSelect (uploadOutput)="onUploadOutput($event)" [uploadInput]="uploadInput">

Then in your component ts file use ViewChild directive to get access to this element:

@ViewChild('uploader', { static: true, read: ElementRef }) uploader: ElementRef;

If you use Angular and MDB Angular v7.x.x, you need to remove the static: true:

@ViewChild('uploader', { read: ElementRef }) uploader: ElementRef;

Now you can reset the file input in startUpload method to resolve the problem:

  startUpload(): void {
      const event: UploadInput = {
      type: 'uploadAll',
      url: 'url-to-backend-endpoint',
      method: 'POST',
      data: { foo: 'bar' },
      this.files = [];
      this.uploader.nativeElement.value = '';

Damian Gemza staff answered 3 years ago


Are you using a file input directives or mdb-file-upload component from File Upload plugin? commented 3 years ago

Hi Damian, i am using file input directives as per the example. it work fine when i upload file1.png, file2.png and file1.png again. but when i upload file1.png and file1.png again it does not post to server at all. i need to upload same file multiple time times and i am renaming them in api.

Arkadiusz Idzikowski staff commented 3 years ago

Thank you for letting us know about that. We will take a closer look at this problem. commented 3 years ago

Hi Team, any update ? when we can expect this fix.

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 7.5.4
  • Device: Window PC
  • Browser: Chrome
  • OS: Window
  • Provided sample code: No
  • Provided link: No