If you have a form that accepts file uploads, then using MIME types for file validation is the more secure way to go, rather than creating an array with the file extensions.
But, as I recently discovered, finding the correct MIME type for Adobe Illustrator .ai files is a bit tricky.
Adobe Illustrator is not mentioned on IANA
If you head over to IANA, which holds all the official MIME types, you’ll notice that Adobe Illustrator is not even mentioned.
Adobe mentions “application/postscript”
If you head over to Adobe’s Assets User Guide, you’ll see that they mention
application/postscript as a MIME type for the Adobe Illustrator .ai file extension.
But does it work? No. I tried.
So, What is the Correct MIME Type for Adobe Illustrator .ai Files?
What do PDF files have to do with AI files?
Well, it seems that they’re related. According to this Wikipedia article, Adobe Illustrator Artwork (AI) is …
a proprietary file format developed by Adobe Systems for representing single-page vector-based drawings in either the EPS or PDF formats. The .ai filename extension is used by Adobe Illustrator.
So, there’s that.
Won’t users be able to upload PDF files, too, with that MIME type?
Unless there will be a separate MIME type especially for Adobe Illustrator files,
application/pdf will enable users to upload both .ai and .pdf files.
You could create another type of validation to block PDF files, though, as a workaround.
That’s a Wrap
I hope this post helped you out!
If you have questions or thoughts, please leave a comment or send me a message using the contact page.
Don’t forget to share the post to help out others!