Quantcast
Channel: PHP- Get file type by URL - Stack Overflow
Viewing all articles
Browse latest Browse all 8

PHP- Get file type by URL

$
0
0

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 all articles
Browse latest Browse all 8

Trending Articles





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