Gargron / fileupload

PHP FileUpload library that supports chunked uploads
MIT License
460 stars 87 forks source link

Validator that supports all file types #7

Closed andheiberg closed 10 years ago

andheiberg commented 10 years ago

Is there someway to support all file types?

Like $validator = new \FileUpload\Validator\Simple(1024 * 1024 * 200, '*');

Gargron commented 10 years ago

If you want to support all file types and all sizes, don't add the validator at all (you don't have to, they're optional modules). If you need to validate only the size, you can very quickly write a new one and add it in. Actually, maybe it would have been better if instead of one Simple validator I created one DefaultTypeValidator and one DefaultSizeValidator, or something along those lines, and illustrated that you can call addValidator multiple times. I dunno. Let me know what you think.

andheiberg commented 10 years ago

I created one DefaultTypeValidator and one DefaultSizeValidator, or something along those lines, and illustrated that you can call addValidator multiple times.

I think that's a great idea.

Also I didn't know adding a validator was optional, so my problem was elevated by that.

Great package by the way.