Fatal error:(Solution) Uncaught exception ‘BadContentTypeException’ with message ‘Required Content-Type not set’ in

27 Aug

Well, i had a nightmare on this, though i have fixed this in the past, i really never thought of documenting it.
well, i paid dearly for with for 3 good days.

here is the famous error that comes up ONLY after you must have gotten everything right, I mean the file permissions, file ownership etc.

Fatal error: Uncaught exception ‘BadContentTypeException’ with message ‘Required Content-Type not set’ in ….

I assume you have the fileinfo extension and magic mime setup already.
if you still get the error after those extensions have been enabled the here is how i finally fixed mine?

Line 1959 of cloudfiles.php is the culprit.

it says

//$local_magic = dirname(__FILE__) . “/share/magic”;

dirname(__FILE__) will resolve to the directory where you have the file you ar running, in my case /var/www/html
so it uses /var/www/html/share/magic as the local magic file, a file that is not there.

so i just removed the dirname() call and specified the full path of the magic file
like this

$local_magic = “/usr/share/magic”; //changed by sledjama

you want to check that the file is in that location or you specify the correct location
try it.


Leave a Reply