Problems uploading specific file types


I was having such a hard time uploading some files from my phone or tablet. I would get errors when upload sound files like .avi or .wav; when I was trying to add voice notes from  my phone to  a post or even uploading pictures taken from my phone. It was not a size issue .

 

Turns out I had to change a couple lines of code in my themes function file :

 

// code for add .wav to uploads
// here we go
function my_myme_types($mime_types){
$mime_types[‘wav’] = ‘audio/x-wav’; //Adding wav extension
return $mime_types;
}

you can just paste this anywhere in functions.php

-you have to change mimetypes for different files, I googled a large list to get the right value for the above code.

Overall this was super frustrating but an easy fix once I sat down to do it.

Leave a comment

Your email address will not be published. Required fields are marked *