$supported_types = array("image/jpg", "image/jpeg", "image/gif", "image/png");
It is possible that your browser is announcing a different mime type. Try capturing the POST http headers for us (wireshark/livehttpheaders/whatever), and we can take a closer look at it.