Site icon Hip-Hop Website Design and Development

Upload mime types for ai illustrator file

Maybe this topic needs updating because i have certainly used this in the past, but today adobe illustrator ai files are not uploading.

So I’m using gravity forms plugin to upload my files.

When I tried to initially uploading these file formats…

  1. PSD
  2. EPS
  3. AI
  4. SVG

I was getting this message: Sorry, this file extension is not permitted for security reasons for all of these file formats.

So I filtered my upload mimes by adding this function to my class…

/**
 * my class constructor
*/
public function __construct()
{

    // allow extra mime type uploads
    add_filter( 'upload_mimes' , array ($this, 'custom_upload_mimes'));

}

/**
 * Allow extra mime types for the sample upload
 *
 * @return array
 */
public function custom_upload_mimes ( $existing_mimes = [] )
{

    $existing_mimes['psd']  = 'image/vnd.adobe.photoshop';
    $existing_mimes['eps']  = 'application/postscript';
    $existing_mimes['ai']   = 'application/postscript';
    $existing_mimes['svg']  = 'image/svg+xml';

    return $existing_mimes;

}

After a bit of testing, all those file types listed above uploaded fine… apart from the illustrator file.

I removed this function and I was not able to upload any of these formats. I re-invoked the function and again, only the illustrator .ai file was returning the error message.

I also tried a very old illustrator file to see if was a file issue but the result was the same.

What should I do to fix this?