I have a question, how can detect a binary file's mime type?
I am creating a system API that allows the client to upload files within my server via API calls. The client must send the image into binary like this:
Code: Select all
function ImgToBinary($pathImg)
{
$con = file_get_contents($pathImg);
$en = base64_encode($con);
return $en;
}
To decode it, I wrote:
Code: Select all
$image = base64_decode($my_binary_image_base64);
Thanks
matt86