Gargron / fileupload

PHP FileUpload library that supports chunked uploads
MIT License
459 stars 87 forks source link

Undefined variables #47

Closed patrickschmidt closed 7 years ago

patrickschmidt commented 7 years ago

I am getting the following two warnings when I upload chunked files

Notice: Undefined variable: completed in [...]/vendor/gargron/fileupload/src/FileUpload/FileUpload.php on line 360

Notice: Undefined property: FileUpload\File::$size in [...]/vendor/gargron/fileupload/src/FileUpload/FileUpload.php on line 579

Cheers, Patrick.

adelowo commented 7 years ago

What release are you making use of ? I want to believe this doesn't exists in the latest release 1.4.1

patrickschmidt commented 7 years ago

I use version v1.4.1

Variable $completed is only set if $file->size == $file_size due to line 345. Which is not true in chunked uploads.

In line 359 a new File object is instantiated and member variable size is not assigned after that.

Maybe that helps.

adelowo commented 7 years ago

@patrickschmidt sorry for the last response, I'd push a fix tomorrow

adelowo commented 7 years ago

late

adelowo commented 7 years ago

@patrickschmidt can you try out the hot-fix branch .. https://github.com/Gargron/fileupload/commit/b3126e08c56a131153e8c08353947aea4b0b694a

Paradinight commented 7 years ago

Small typo in the fix. On line 310 $complteted = false; to $completed = false;

The mime type validation does not work if i use the chunked file upload. Without the the mime_type validation the fix work :)

Fixing the mime type validation is hard. finfo_file only works if the upload is completed.

adelowo commented 7 years ago

Oops, thanks a lot.. I switched to sublime text, phpstorm would have alerted me of a typo.. Would fix that.

THanks for testing it, I would tag a new version.

As per the mime type validation, that would be pretty hardcore to tackle.

adelowo commented 7 years ago

Just merged in #48 and i tagged 1.4.2 .

Thanks a lot