PHP code example of jstewmc / validate-file-size

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

    

jstewmc / validate-file-size example snippets


use Jstewmc\ValidateFileSize\Validate;

// set the file's name
$filename = '/path/to/foo.php';

// create a three-byte file
file_put_contents($filename, 'foo');

// check the file's size
(new Validate(0, 1))($filename);    // returns false
(new Validate(0, 999))($filename);  // returns true