0

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?

2 Answers 2

2

Please try this:

$mime_types[ 'eps' ] = 'application/postscript';
$mime_types[ 'ai'  ] = 'application/pdf';
$mime_types[ 'svg' ] = 'image/svg+xml';`

and then return $mime_types

1
  • Thank you let me check soon, i'll get back to you.
    – joshmoto
    Dec 3, 2019 at 6:49
1

im putting this info here (not about upload) but according to adobe docs the mime types list as following

for .ai is application/postscript

for eps can be any of the following EPS

  1. application/postscript
  2. application/eps
  3. application/x-eps
  4. image/eps
  5. image/x-eps

for psd is image/vnd.adobe.photoshop

for svg is image/svg+xml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.