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?

0

Please try this:

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

and then return $mime_types

| improve this answer | |
  • Thank you let me check soon, i'll get back to you. – joshmoto Dec 3 '19 at 6:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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