PHP code example of nbish11 / fileinfo
1. Go to this page and download the library: Download nbish11/fileinfo library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nbish11 / fileinfo example snippets
o = new FileInfo('C:/path/to/file.txt');
// Using standard API methods:
echo $finfo->getDirectory(); // 'C:/path/to/'
echo $finfo->getBaseName(); // 'file.txt'
echo $finfo->getExtension(); // 'txt'
echo $finfo->getFileName(); // 'file'
echo $finfo->getMimeType(); // 'text/plain'
// Using class properties:
echo $finfo->directory; // 'C:/path/to/'
echo $finfo->basename; // 'file.txt'
echo $finfo->extension; // 'txt'
echo $finfo->filename; // 'file'
echo $finfo->mimetype; // 'text/plain'