file : add fileinfoMimeType and filesize
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@4178 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
27
file.php
27
file.php
@@ -226,6 +226,33 @@ class file
|
||||
return filemtime ($filename);
|
||||
}
|
||||
|
||||
/** Get the file size
|
||||
* @param string $filename Path to the file
|
||||
* @return the size of the file or FALSE on failure.
|
||||
* @throws If parent directory not exists, is not writeable
|
||||
*/
|
||||
public function filesize ($filename)
|
||||
{
|
||||
$this->debug (2, "filesize ($filename)");
|
||||
$filename = $this->realpath ($filename);
|
||||
$this->checkPathRO (dirname ($filename));
|
||||
return filesize ($filename);
|
||||
}
|
||||
|
||||
/** Get the file info of the provided filename
|
||||
* @param string $filename Path to the file
|
||||
* @return the mimetype of the file
|
||||
* @throws If parent directory not exists, is not writeable
|
||||
*/
|
||||
public function fileinfoMimeType ($filename)
|
||||
{
|
||||
$this->debug (2, "filesize ($filename)");
|
||||
$filename = $this->realpath ($filename);
|
||||
$this->checkPathRO (dirname ($filename));
|
||||
$finfo = new \finfo (FILEINFO_MIME_TYPE);
|
||||
return $finfo->file ($filename);
|
||||
}
|
||||
|
||||
/** Return the current working directory
|
||||
* @return string the current working directory */
|
||||
public function getcwd ()
|
||||
|
||||
Reference in New Issue
Block a user