#WebDev

The Correct MIME Type for Adobe Illustrator (.ai) Files

by Radu

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?

It’s application/pdf. Yep.

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?

Unfortunately, yes.

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 some info is outdated or incorrect, or you have anything to add, say or ask, please contact me via Twitter or email.

About Radu

I've been working online, from home, for over 9 years. I learned a lot of different stuff related to websites. My main expertise is WordPress, but for some time, I started focusing more on web development.