1. Go to this page and download the library: Download bfitech/zapchupload 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/ */
bfitech / zapchupload example snippets
FITech\ZapCore\Router;
use BFITech\ZapCore\Logger;
use BFITech\ZapChupload\ChunkUpload;
// create a logging service
$log = new Logger;
// create a router
$core = (new Router)->config('logger', $log);
// instantiate the chunk uploader class
$chup = new ChunkUpload(
$core, '/tmp/tempdir', '/tmp/destdir',
null, null, null, $log);
// uploader route
$core->route('/upload', [$chup, 'upload'], 'POST');
// downloader route for testing
$core->route('/', function($args) use($core) {
$file = $args['get']['file'] ?? null;
if ($file)
$core->static_file('/tmp/destdir/' . $file);
$core::halt('HELLO WORLD');
});
// that's it