PHP code example of innmind / filesystem

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

    

innmind / filesystem example snippets


use Innmind\Filesystem\{
    File,
    File\Content,
    Directory,
    Adapter\Filesystem,
};
use Innmind\Url\Path;

$directory = Directory::named('uploads')->add(
    File::named(
        $_FILES['my_upload']['name'],
        Content::ofString(\file_get_contents($_FILES['my_upload']['tmp_name'])),
    ),
);
$adapter = Filesystem::mount(Path::of('/var/www/web/'));
$adapter->add($directory);