I'm working on new version of on-line photo printing software. So I tested your package. In this case often happens that users send the same file.
I enabled duplicate uploads via JS:
var flow = new Flow({
target: 'upload.php',
allowDuplicateUploads: true,
});
When you select same file multiple times until first upload is finished only one file is saved.
To easy reproduce use this code (upload.php):
<?php
require_once './vendor/autoload.php';
$config = new \Flow\Config();
$config->setTempDir('./tmp');
$request = new \Flow\Request();
$uploadFolder = './upload/'; // Folder where the file will be stored
$uploadFileName = uniqid()."_".$request->getFileName(); /
$uploadPath = $uploadFolder.$uploadFileName;
if (\Flow\Basic::save($uploadPath, $config, $request)) {
// file saved successfully and can be accessed at $uploadPath
} else {
// This is not a final chunk or request is invalid, continue to upload.
}
sleep(10);
And add sleep(5) to /vendor/flowjs/flow-php-server/src/Flow/File.php, line 192.
sleep(5);
if ($this->config->getDeleteChunksOnSave()) {
$this->deleteChunks();
}
Just before chunks are merged.
Explanation: Flow.js creates same identifier for same fille. Flow-PHP-Server uses this identifier for chunk names (after hasing) = same chunk names for different uploads. When first file is merged chunks for next one are deleted. So another file cannot be created.
I'm working on new version of on-line photo printing software. So I tested your package. In this case often happens that users send the same file.
I enabled duplicate uploads via JS:
When you select same file multiple times until first upload is finished only one file is saved.
To easy reproduce use this code (upload.php):
And add
sleep(5)
to/vendor/flowjs/flow-php-server/src/Flow/File.php
, line 192.Just before chunks are merged.
Explanation: Flow.js creates same identifier for same fille. Flow-PHP-Server uses this identifier for chunk names (after hasing) = same chunk names for different uploads. When first file is merged chunks for next one are deleted. So another file cannot be created.