Closed christofflueck closed 4 years ago
I've faced the same issue... As a workaround I used custom filename generator like that:
// define your own algorithm to get name using provided parameters:
// $source_name, $type, $tmp_name, $index, $content_range, $upload
$filenamegetter = function(
$source_name,
$type,
$tmp_name,
$index,
$content_range,
$upload
) {
// in my case it is enough just to get original file name
return $source_name;
};
$pathresolver = new \FileUpload\PathResolver\Simple('/path/to/file');
$filesystem = new \FileUpload\FileSystem\Simple();
$fileupload = new \FileUpload\FileUpload($_FILES['files'], $_SERVER);
// create filename generator with your algorithm
$filenamegenerator = new \FileUpload\FileNameGenerator\Custom($filenamegetter);
// set filename generator for file upload
$fileupload->setFileNameGenerator($filenamegenerator);
$fileupload->setPathResolver($pathresolver);
$fileupload->setFileSystem($filesystem);
list($files, $headers) = $fileupload->processAll();
This should be fixed by https://github.com/Gargron/fileupload/pull/79
Was a new version ever tagged & released? ... it's still broken in the latest release :(
Can confirm this is still present in v1.5.1
Any news about the release?
PHP Version: 7.4 Fileupload Version: 1.5.1
When using the Random Filename generator I get this notice:
Notice: Trying to access array offset on value of type null in .....\vendor\gargron\fileupload\src\FileUpload\FileNameGenerator\Random.php on line 70
Which is this line of code:
$uploaded_bytes = Util::fixIntegerOverflow(intval($content_range[1]));