I have a web service for iPhone. I receive an image from iPhone in binary form. What I want to ask is can we determine the extension of image being send in binary form.
my code:
$data=base64_decode($data);
$path='event_image/img_out.gif'; /// issue is here
$fp=fopen($path,'w+');
if($fp){ fwrite($fp,$data); fclose($fp); }
Files have signatures http://www.garykessler.net/library/file_sigs.html
You can read from the first line of the file and check.