PHP code example of orajo / zf2-tus-server

1. Go to this page and download the library: Download orajo/zf2-tus-server 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/ */

    

orajo / zf2-tus-server example snippets


/**
 * Laminas action for uploading files
 */
public function uploadAction() {
     // Create and configure server
    $debug = false;
    // The internal adapter
    $adapter = new League\Flysystem\Local\LocalFilesystemAdapter(
        __DIR__.'/storage/'
    );

    // The FilesystemOperator
    $filesystem = new League\Flysystem\Filesystem($adapter);

    $server = new \ZfTusServer\Server('/path/to/save/file', 
                           $this->getRequest(),
                           $adapter
                           $debug
    );

    // Run server
    $server->process(true);
}