Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: MDB Angular File Upload plug-in version (and possibly) other issues

lham priority asked 2 years ago


Expected behavior: When adding [acceptedExtensions]="'.csv'" to mdb-file-upload tag, file upload should accept .CSV file

Actual behavior: When I select a .csv file and submit, an error occurs about file being wrong format?

Resources (screenshots, code snippets etc.):

I love MDB

I love MDB

Also, unclear on how to integrate this into a form file upload? Thanks for your help!

PS: Small issue with this word: Happened

-Lawrence


lham priority commented 2 years ago

It looks like my first issue might be an ng version mismatch from 12 to 13.

My project template was created with Angular 12 with "mdb-angular-ui-kit": "git+https://oauth2:fugazi@git.mdbootstrap.com/mdb/angular/mdb5/prd/mdb5-angular-ui-kit-pro-essential"

When I cloned my new project from my template that package now downloads mdb5 for Angular 13.

I'll try pointing it to an older version tag from the git repo.


lham priority commented 2 years ago

Updated my Angular 12 package.json to:

"mdb-angular-file-upload": "git+https://oauth2:fugazi@git.mdbootstrap.com/mdb/angular/mdb5/plugins/prd/file-upload#1.1.0",

"mdb-angular-ui-kit": "git+https://oauth2:fugazi@git.mdbootstrap.com/mdb/angular/mdb5/prd/mdb5-angular-ui-kit-pro-essential#1.6.1"

The issue still exists, it was not the ng version mismatch.


Arkadiusz Idzikowski staff commented 2 years ago

@lham Can you try to find the mdb-angular-file-upload package in node_modules and check the package.json to confirm that v1.1.0 was installed correctly? We added some improvements for accepted extensions in this version.

Thank you for the information about the typo, we will fix that as soon as possible. You can edit this message in mainError input.


lham priority commented 2 years ago

@Arkadiusz Idzikowski ".csv" extension is not hard-coded into the mappings of mime types to extensions, simply changing [acceptedExtensions]="'.csv'" to [acceptedExtensions]="'application/vnd.ms-excel, .csv'" has solved the problem :)


Arkadiusz Idzikowski staff commented 2 years ago

@lham Glad it works and thank you for the information about the fix, we will update the mime type list.



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Resolved

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Angular
  • MDB Version: MDB5 2.0.0
  • Device: PC
  • Browser: Chrome and Edge
  • OS: Windows 11
  • Provided sample code: No
  • Provided link: No