Location: PHPKode > scripts > File_Info > file_info/README-en.html
<html>
<head>
	<title>File_Info class</title>
	<style>
		P.codice { background-color: #EAEAEA }
	</style>
</head>

<body>

<a name="top"><center><h1>Classe File_Info</h1></center></a>
<hr width="100%" />

<b>Index</b><br />
<a href="#descrizione">description</a><br />
<a href="#sinossi">Synopsis</a><br />
<a href="#costanti">Constants defined by the class</a><br />
<a href="#funzioni">Class functions</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#funzioni_getname">getName()</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#funzioni_getbasename">getBasename()</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#funzioni_getextension">getExtension()</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#funzioni_getdirname">getDirname()</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#funzioni_getpath">getPath()</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#funzioni_getmime">getMime()</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#funzioni_gettype">getType()</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#funzioni_getsize">getSize()</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#funzioni_getatime">getAtime()</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#funzioni_getmtime">getMtime()</a><br />
<a href="#licenza">License</a><br />
<a href="#autore">Author</a><br />

<hr width="100%" />

<a name="descrizione"><b>Description</b></a><br />
<br />
This class allows you to quickly get informations about a file:<br />
<br />
name<br />
extension<br />
full path<br />
directory name<br />
file type<br />
mime type<br />
size<br />
last modification time<br />
last access time<br />
<br />
This README is related to 0.4 version of the class, release on  25/09/03.<br />
<br />
<a href="#top">Back to start</a><br />

<hr width="100%" />

<a name="sinossi"><b>Synopsis</b></a><br />
<br />
<p class="codice">
require_once '/path/to/File_Info.php';<br />
<br />
$file = '/path/to/file.xyz';<br />
<br />
$f = new File_Info($file);<br />
<br />
/*<br />
  Let's get the infos<br />
  through the class functions<br />
*/<br />
echo 'MIME Type: ' . $f-&gt;getMime();<br />
</p>
<br />
<a href="#top">Back to start</a><br />

<hr width="100%" />
<a name="costanti"><b>Constants defined by the class</b></a><br />
<br />
The constants below are used in <a href="#funzioni_getsize">getSize()</a> function to determine the desired size order. The function returns the
file size, that may be expressed in byte,  Kb, Mb, Gb or Tb.<br /><br />
<table width="100%" cellpadding="2" cellspacing="0" border="1">
<tr>
	<td width="200"><b>Constant name</b></td>
	<td width="70"><b>Value</b></td>
	<td><b>Meaning</b></td>
</tr>
<tr>
	<td>FILE_INFO_SIZE_BYTE</td>
	<td>1</td>
	<td>Express the size value in byte (DEFAULT)</td>
</tr>
<tr>
	<td>FILE_INFO_SIZE_KB</td>
	<td>2</td>
	<td>Express the size value in KiloByte</td>
</tr>	
<tr>
	<td>FILE_INFO_SIZE_MB</td>
	<td>3</td>
	<td>Express the size value in MegaByte</td>
</tr>	
<tr>
	<td>FILE_INFO_SIZE_GB</td>
	<td>4</td>
	<td>Express the size value in GigaByte </td>
</tr>	
<tr>
	<td>FILE_INFO_SIZE_TB</td>
	<td>5</td>
	<td>Express the size value in TeraByte</td>
</tr>	
</table>
<br />

<a href="#top">Back to start</a><br />

<hr width="100%" />

<a name="funzioni"><b>Class functions</b></a><br />
<br />

<ul>
	<li>
		<a name="funzioni_getname">string getName()</a><br />
		Returns the file name, without path and extension<br />
		<a href="#top">Back to start</a><br /><br />
	</li>

	<li>
		<a name="funzioni_getbasename">string getBasename()</a><br />
		Returns the basename ("filename.extension")<br />
		<a href="#top">Back to start</a><br /><br />
	</li>

	<li>
		<a name="funzioni_getextension">string getExtension()</a><br />
		Returns the extension, without the starting dot<br />
		<a href="#top">Back to start</a><br /><br />
	</li>

	<li>
		<a name="funzioni_getdirname">string getDirname()</a><br />
		Returns the file directory name <br />
		<a href="#top">Back to start</a><br /><br />
	</li>

	<li>
		<a name="funzioni_getpath">string getPath()</a><br />
		Returns the full path ("directory/filename.extension")<br />
		<a href="#top">Back to start</a><br /><br />
	</li>

	<li>
		<a name="funzioni_getmime">string getMime()</a><br />
		Returns the MIME type. (If unknown, returs "application/octet-stream")<br />
		<a href="#top">Back to start</a><br /><br />
	</li>

	<li>
		<a name="funzioni_gettype">string getType()</a><br />
		Returns the file type, for example "JPEG image" for .jpg files<br />
		<a href="#top">Back to start</a><br /><br />
	</li>

	<li>
		<a name="funzioni_getsize">mixed getSize([int dim = FILE_INFO_SIZE_BYTE] [, int round = 2])</a><br />
		Returns the file size. $dim, optional, give the size order to use. Possible values are:<br />
		<br />
		FILE_INFO_SIZE_BYTE (default) gets the value in byte<br />
		FILE_INFO_SIZE_KB gets the value in Kilobyte<br />
		FILE_INFO_SIZE_MB gets the value in Megabyte<br />
		FILE_INFO_SIZE_GB gets the value in Gigabyte<br />
		FILE_INFO_SIZE_TB gets the value in Terabyte<br />
		<br />
		$round, optional, gives the decimal numbers for non-integers file sizes. Default is 2.<br />
		<a href="#top">Back to start</a><br /><br />
	</li>

	<li>
		<a name="funzioni_getatime">getAtime()</a><br />
		Returns the last access time, in Unix timestamp format<br />
		<a href="#top">Back to start</a><br /><br />
	</li>

	<li>
		<a name="funzioni_getmtime">getMtime()</a><br />
		Returns the last modification time, in Unix timestamp format<br />
		<a href="#top">Back to start</a><br /><br />
	</li>
	
</ul>

<br />

<a href="#top">Back to start</a><br/>

<hr width="100%" />

<a name="licenza"><b>License</b></a><br />
<br />
This class is free software and it's distributed under the terms of GNU LGPL ( Lesser General Public License) license.<br />
You can get a copy of the license, in English language, on <a href="http://www.fsf.org/">Free Software Foundation</a> web site:<br />
<a href="http://www.fsf.org/copyleft/lesser.html">http://www.fsf.org/copyleft/lesser.html</a><br />
<br />
<a href="#top">Back to start</a><br/>

<hr width="100%" />
<a name="autore"><b>About author</b></a><br />
author: Marco Bonzanini<br />
homepage: <a href="http://marcobonzanini.has.it">http://marcobonzanini.has.it</a><br />
e-mail: m-bonza AT libero DOT it<br />
<br />
<a href="#top">Back to start</a><br/>
</body>
</html>
Return current item: File_Info