View Full Version : Link information

05-24-2004, 02:29 AM
I was wondering if I could get information from a link like the file type, file size and if its active or not
could i retrive the file size of that zip file, be able to know that its a zip file and if you click on it it will download and not come up with a "The page cannot be displayed" due to the fact the link doesnt exsist.
I have heard of linkinfo() but no idea how it works
Help would be great thanks

05-24-2004, 10:27 AM
you can simpy use (to see if a file exists) ....with e.g. the url domain.com/download.php?filename=myfile.zip

//always supply the path here never in the query string
$filename= '/home/user/downloads/'.$_GET['filename'];

//file exists so grab it
//bad link

Determining the type other than simply looking at the file extension may require something like mime_content_type() (http://php.net/mime_content_type)

05-24-2004, 04:08 PM
is it possible just to find out what the extention is just by looking at the end of the file after the dot as i get an error when I try mime_content_type() and is it possible to know how big the file is
and note that the url wont be on my server it will be ok someone elses eg i host the php file that checks to see if this url on this other server works and how big it is and file type
thanks and sorry if that sounded cofusing but thanks