vlucas/valitron

How to validate document type (pdf, docx, xls, etc)

Closed this issue · 2 comments

hi, this is my first time i use this package, so validate documents file is so hard i think, i didnt find any way in stackoverflow, etc.

i tried like this :

// Code Above
$validation->rule('in', 'type', ['application/docx', 'application/xls']);

but when i upload docx / xls file format still got error wrong format, i think validate document is same as like validate image format, but there is quite different.

so maybe you guys can help me out of this problem :D
any help will be appreciated

thanks anyway

Seems like you have the wrong mime types. For docx it's application/vnd.openxmlformats-officedocument.wordprocessingml.document for example.

I don't know this by heart, I used this handy list :)

finally, i found a great solution, thank you very much.
anyway, this documentation should have more example, not the basic but a bit complex case like this (because i even not found validate image in this main page) :D