PHP Classes

PHP File Magic: Check file access and execution permissions

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 75 All time: 10,198 This week: 488Up
Version License PHP version Categories
filemagic 1.0GNU General Publi...5.3PHP 5, Files and Folders
Description 

Author

This class can check file access and execution permissions.

It can detect the file MIME type using the finfo extension and well check its access permissions.

If the file has read access permissions it can also return its size, file type, file access statistics, MIME types, executable permissions, and contents hash values.

Picture of Wladek
  Performance   Level  

 

Example

<?php

require __DIR__.DIRECTORY_SEPARATOR.'filemagic.php';
$m= new FileMagic('/bin/bash');

// This test generates all information regarding to the filename
var_dump($m->collected());
// OR we need the MIME type of affected file
var_dump($m->mime());
// OR we need an info about the file whether executeable or not reagrding to its mime type
var_dump($m->executable());


  Files folder image Files (2)  
File Role Description
Plain text file filemagic.php Class The FileMagic class
Accessible without login Plain text file test.php Example An example for FileMagic class

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:75
This week:0
All time:10,198
This week:488Up