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

accept restrictions #12

Open
neekers opened this issue Mar 4, 2014 · 3 comments
Open

accept restrictions #12

neekers opened this issue Mar 4, 2014 · 3 comments

Comments

@neekers
Copy link

neekers commented Mar 4, 2014

Another attribute could be "accept" to limit file types.

@davidstanley01
Copy link

I added an "allowedOptions" key to the s3UploadOptions object to contain an array of acceptable MIME types. Then, I added the following to the directive at line 62.

if (opts.allowedTypes) {
   if (opts.allowedTypes.indexOf(selectedFile.type) === -1) {
       throw Error("Invalid MIME type");
   }
}

This works for me. I'd be happy to put it in a pull request...

@asafdav
Copy link
Owner

asafdav commented Oct 20, 2014

Hi, looks good.
Please send a pull request. also please note that currently your code doesn't handle a case where the file's MIME type couldn't be determined. (file.type would return an empty string in that case).
you can convert it into application/octet-stream before performing your test.

@davidstanley01
Copy link

No problem. I'll send it over tonight or tomorrow. Thanks!

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

No branches or pull requests

3 participants