Code Monkey home page Code Monkey logo

Comments (3)

AckerApple avatar AckerApple commented on August 11, 2024 2

It is the browser that reveals the mime type. Standards exists for how the whole reading of files goes in a browser. This package, angular-file, essentially wraps all the adhering of standards for browser file reading into an Angular package.

For the mime type, this package, just takes what the browser gives it during select/drag/drop and then it does it's best to see if mime types match occurs as follows:

  1. This package tries an exact mime match as seen in this code:
  1. This package tries to match by file extension as seen in this code:

All of the above mentioned mime type comparing and parsing, is unit tested in this code here:
https://github.com/AckerApple/angular-file/blob/development/src/file-upload/fileTools.spec.ts

Please let me know if you have additional input, see a mime type comparison issue, love pinball, or let me know anything else I can help with

from angular-file.

AckerApple avatar AckerApple commented on August 11, 2024

"Or am I missing something ?"

Yes, that is correct.

Are you using Internet Explorer or Internet Edge? As I last came to understand, during drag drop they don't reveal a files mime type. I've seen a few browsers that think it's a security risk to reveal any file information about a file during drag just incase the drag/drop is not intended for whats being dragged over.

So try, instead of drag/drop, selecting files and see if you get the results you desire.

Lastly, this package does NOT keep any mime type listings. It's up to you to type in the correct mime type. I've seen CSV as many things including text/comma-separated-values. Files can even be written with no mime type and then its up to the code to decide to assume the file extension is the right type.

Mime typing is a long a vast story. I recommend using more star like validations such as image/* or text/*

Good luck to you

from angular-file.

Knu111 avatar Knu111 commented on August 11, 2024

Thanks for the answer

No, I use Firefox..

Maybe you answered to this and I didn't get it but I have one last question to clarify my thoughts...
Who determine the file type (see picture) when they are dragged or selected ? Is it your composant (angular-file) or the browser ?
untitled

Thanks again :)

from angular-file.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.