To use this project we recommend you to use point cloud technology's fork that is a maintained version of the original resumable.js library.
To install, use composer:
composer require code-lts/resumable.php
upload.php
<?php
include __DIR__ . '/vendor/autoload.php';
use ResumableJs\Resumable;
// Any library that implements Psr\Http\Message\{ServerRequestInterface, ResponseInterface};
// See https://github.com/Nyholm/psr7 as a tested example
$resumable = new Resumable($request, $response);
$resumable->tempFolder = 'tmps';
$resumable->uploadFolder = 'uploads';
$resumable->process();
$originalName = $resumable->getOriginalFilename(); // will give you the original end-user file-name
$mySafeName = Security::sanitizeFileName($request->query('resumableFilename'));
$resumable->setFilename($mySafeName);// Override the safe filename
// process upload as normal
$resumable->process();
// you can also get file information after the upload is complete
if (true === $resumable->isUploadComplete()) { // true when the final file has been uploaded and chunks reunited.
$filename = $resumable->getFilename();
}
$resumable->getOriginalFilename()
does not have a parameter to return the name without the extension$resumable->getExtension()
implement the logic yourselfpreProcess()
no longer exists, it was not very useful- the default value of
uploadFolder
wastest/files/uploads
and is nowuploads
- Does not calculate the number of chunks, it uses the param
resumableTotalChunks
$ ./vendor/bin/phpunit