Проблема в строке 496 и строке 1429 в файле UploadHandler. php
////////////////////////////////// ////////////////////////////////////////////////// ////////
Код вокруг строки 496
////////////////////////////////// ////////////////////////////////////////////////// ////
protected function get_unique_filename($file_path, $name, $size, $type, $err
or,
$index, $content_range) {
while(is_dir($this->get_upload_path($name))) {
$name = $this->upcount_name($name);
}
// Keep an existing filename if this is part of a chunked upload:
//BELOW is line 496
$uploaded_bytes = $this->fix_integer_overflow((int)$content_range[1]);
while (is_file($this->get_upload_path($name))) {
if ($uploaded_bytes === $this->get_file_size(
$this->get_upload_path($name))) {
break;
}
$name = $this->upcount_name($name);
}
return $name;
}
/////////////////////////////////////////// ///////////////////////////////////////////////
И код вокруг строки 1429
///////////////////////////////////////// //////////////////////////////////////////////
$response = array($this->options['param_name'] => $files);
$name = $file_name ? $file_name : $upload['name'][0];
$res = $this->generate_response($response, $print_response);
if(is_file($this->get_upload_path($name))){
// BELOW IS LINE 1429
$uploaded_bytes = $this->fix_integer_overflow((int)$content_range[1]);
$totalSize = $this->get_file_size($this->get_upload_path($name));
if ($totalSize - $uploaded_bytes - $this->options['readfile_chunk_size'] < 0) {
$this->onUploadEnd($res);
}else{
$this->head();
$this->body(json_encode($res));
}
}else{
$this->head();
$this->body(json_encode($res));
}
Проблема в значении $ content_range [1], когда загружаемый файл не разделяется на части. Значение $ content_range [1] необходимо проверить, чтобы определить, установлено ли оно.
Ниже приведено решение для двух фрагментов кода, которые выдавали ошибку. Сначала код в строке 496
protected function get_unique_filename($file_path, $name, $size, $type, $error,
$index, $content_range) {
while(is_dir($this->get_upload_path($name))) {
$name = $this->upcount_name($name);
}
// Keep an existing filename if this is part of a chunked upload:
if(isset($content_range[1])){
$uploaded_bytes = $this->fix_integer_overflow((int)$content_range[1]);
}
while (is_file($this->get_upload_path($name))) {
if(isset($uploaded_bytes)){
if ($uploaded_bytes === $this->get_file_size(
$this->get_upload_path($name))) {
break;
}
}
$name = $this->upcount_name($name);
}
return $name;
}
И второй бит в коде 1429.
$response = array($this->options['param_name'] => $files);
$name = $file_name ? $file_name : $upload['name'][0];
$res = $this->generate_response($response, $print_response);
if(is_file($this->get_upload_path($name))){
if(isset($content_range[1])){
$uploaded_bytes = $this->fix_integer_overflow((int)$content_range[1]);
}
else{
$uploaded_bytes = 0;
}
$totalSize = $this->get_file_size($this->get_upload_path($name));
if ($totalSize - $uploaded_bytes - $this->options['readfile_chunk_size'] < 0) {
$this->onUploadEnd($res);
}else{
$this->head();
$this->body(json_encode($res));
}
}else{
$this->head();
$this->body(json_encode($res));
}
return $res;