Library for tus server (tus protocol 1.0)
use composer
This libbrary depends on Flysystem
/**
* 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);
}
If you are with an Apache server, add an .htaccess file to redirect all request in the php page (without that, your PATCH call failed), like :
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
Jaroslaw Wasilewski [email protected].
This library is based on library (https://github.com/leblanc-simon/php-tus) by Simon Leblanc [email protected].