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

Deny mime type before uploading? #1525

Closed
paulcanning opened this issue Jul 13, 2016 · 5 comments
Closed

Deny mime type before uploading? #1525

paulcanning opened this issue Jul 13, 2016 · 5 comments
Assignees
Labels

Comments

@paulcanning
Copy link

Currently, to disallow a mime type, the file has to be upload to the server first then it comes back saying the file type is not allowed.

This is useless for huge files, as I need to be able to have elFinder inform the user that the mime type is not allowed after then select a file, before it gets uploaded.

I cannot use the client option onlyMimes as the list is huge and allowed types may change quickly and frequently. I only need to stop certain ones e.g .exe

Is this possible?

@nao-pon nao-pon self-assigned this Jul 14, 2016
@paulcanning
Copy link
Author

Also, to add to this (unless there is a solution already) can we check file extensions, rather then mime types? I want to allow users to add their own extensions to a deny list in a backend system, but they might not know the exact mime type for a particular file extension.

@nao-pon
Copy link
Member

nao-pon commented Jul 14, 2016

We plan to use the MIME type of the type property of the browser of file objects. It does not check when the MIME type can not be acquired.

@paulcanning
Copy link
Author

Is there anyway to use the client option onlyMime to deny file types right now?

For example, I want to hide files with extension exe in the file dialog window, but onlyMimes is a list of allowed file types as it stands.

@nao-pon
Copy link
Member

nao-pon commented Jul 14, 2016

onlyMime is allowed filter only. By the way what about volume option accessControl?

e.g. in accessControl call back function

if ($attr === 'hidden') {
    if (preg_match('/\.exe$/i', $path)) {
        return true;
    }
}

@paulcanning
Copy link
Author

How will the new check work? Is it a client option? And when will it be ready to roll out? :)

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

No branches or pull requests

2 participants