Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: allowedContentTypes to match HTML5 input "accept" #499

Open
zbagley opened this issue Jul 18, 2019 · 2 comments · May be fixed by #502
Open

Enhancement: allowedContentTypes to match HTML5 input "accept" #499

zbagley opened this issue Jul 18, 2019 · 2 comments · May be fixed by #502

Comments

@zbagley
Copy link

zbagley commented Jul 18, 2019

Description

Currently allowedContentTypes for input options only seems to accept very specific MIME types. The expected results would be that the allowedContentTypes array would match how a DOM <input accept="<allowedContentTypes>" performs.

Specific Issues

Noticed mismatch on:
blanket MIME types (image/*, audio/*)
specific extensions (.dae, .dxf)

Reproduction

Using the demo .ts and .html files, append options to include:

allowedContentTypes: ['image/*', '.dae']

This results in the input rejecting all image files and .dae extension files.

Append <input accept="image/*, .dae" /> and image files and .dae extensions are no longer rejected, but are the only files allowed to be selected for upload.

mrbatista added a commit to mrbatista/ngx-uploader that referenced this issue Aug 1, 2019
@mrbatista mrbatista linked a pull request Aug 1, 2019 that will close this issue
mrbatista added a commit to mrbatista/ngx-uploader that referenced this issue Aug 1, 2019
mrbatista added a commit to mrbatista/ngx-uploader that referenced this issue Aug 1, 2019
@andzejsw
Copy link

Any progress?

@andzejsw
Copy link

andzejsw commented Feb 11, 2020

Some Mime types not recognized, like for example .asc should be text/plain but instead it shows empty string. Then easier is to write method in addedToQueue upload case and then check file extensions, before pushing in upload files list:

            case 'addedToQueue':
                let extension = this.file.name.split('.')[1];
                if (this.allowedFileExtensions.indexOf(extension) === -1) {
                    this.notification.danger('notifications.only-cypher-files');
                    return;
                }
                this.files.push(output.file);
                break; 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants