PHP code example of msgframework / file

1. Go to this page and download the library: Download msgframework/file 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/ */

    

msgframework / file example snippets

 php
...
use Msgframework\Lib\File\File;

$file = new File($path);
 php
...
$file = new File($path);
$allow_extensions = array('jpg', 'png');

if (!in_array($extension = $file->getExtension(), $allow_extensions)) {
    throw new \RuntimeException(sprintf('File extension "%s" not allowed, allow: %s', $extension, implode(", ", $allow_extensions)));
}
 php
...
$file = new File($path);

$content = $file->getContent();