Quantcast
Viewing latest article 8
Browse Latest Browse All 8

PHP- Get file type by URL

I want to get the file type (eg. image/gif) by URL using PHP.I had tried

<?php$image_path="http://fc04.deviantart.net/fs71/f/2010/227/4/6/PNG_Test_by_Destron23.png";exif_imagetype($image_path);?>

The above code gave me a blank page and the following code returned "3":

<?php$image_path="http://fc04.deviantart.net/fs71/f/2010/227/4/6/PNG_Test_by_Destron23.png";echo exif_imagetype($image_path);?>

Where am I going wrong?Solved: using Fileinfo to fetch content type


Viewing latest article 8
Browse Latest Browse All 8

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>