So ...

Let's see our example with a PSD file ... In order to allow PSD uploads you'll have to add the following code:

function my_myme_types($mime_types)
{$mime_types['psd'] = 'image/vnd.adobe.photoshop'; //Adding photoshop files return $mime_types;}
add_filter('upload_mimes', 'my_myme_types', 1, 1);

Basically, the function creates an array ($mime_types) and the actual file type (psd) goes as its value. In the above example, the PSD file extension represents files with the mime type image/vnd.adobe.photoshop.

And of course, you can add several file types. Here's the same function allowing the SVG and PSD extensions:

function my_myme_types($mime_types)
{$mime_types['svg'] = 'image/svg+xml'; //Adding svg extension
$mime_types['psd'] = 'image/vnd.adobe.photoshop'; //Adding photoshop files
return $mime_types;}
add_filter('upload_mimes', 'my_myme_types', 1, 1);

I simply added a new array element for the SVG file type using the image/svg+xml mime type.

You can find out the correct mime types of several common file extensions here.

And that's it ... After saving the changes (uploading the edited functions.php file) you'll be able to upload those files using the default media uploader. In my case, the PSD e-book cover:


As you can see, it's really not rocket science ...

And that's it my friends!

If you have any comments, further questions or update requests please don't hesitate to react! Like, comment and share!

And don't forget, you can easily come back to this tutorial whenever you want.

All you need to do is to bookmark the categorized, daily updated register of my blogs and training materials. Here it is:

Posts and training by smartketeer

Thanks for your time!



Join the Discussion
Write something…
Recent messages
AlanJE Premium Plus
Thanks for the great training, Zed, I bookmarked it for reference, Alan
Reply
BorisRoman Premium Plus
Awesome training!
Thanks a lot!
Wish you a smooth weekend!
Bob
Reply
smartketeer Premium
Thanks Bob!

Have a great weekend!
Reply
dowj01 Premium
Awesome, thank you. You have made a complex activity quite straightforward.
Justin
Reply
smartketeer Premium
Thanks for the time Justin!
Reply
Top