New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$_FILES missing size and type after flow.js upload #155
Comments
I think I found it. flow.js:1052
flow.js:1331
Parameters are switched here. Change line 1052 to
and it works. |
nice catch @arkuuu ! i'm already retesting your fix and i will be back to you shortly :) |
@evilaliv3 yes, I was using flow.js from the master branch, not the released version. |
okay! i'm taking care of this now implementing all the unit tests that would have helped finding this bug. @AidasK: are you planning to release the master branch than? a lot of bugfixing and improvements have been done since 2.9.0 |
Thanks @arkuuu, nice catch. Maybe node.js sample will work after this. If it will, we can make a 2.10.0 release |
@AidasK exactly! just retested the nodejs sample and IT WORKS! all ready for a super 2.10.0 👍 |
@evilaliv3 I have tried node.js sample, and it seems uploaded file is missing last chunk. I have tried files bigger than a chunks size (> 1mb). |
this is probably showing that we would require to improve the unit tests as they are not covering the situation where the file is bigger than the chunksize? |
i'm going to investigate this issue now. |
If I set |
Everything works if I remove: So everything should be fine if we could fix |
i'm investigating also; since now i discovered that the issue is for sure in the last chunk. right now the differences i see between 2.9.0 and master is that in 2.9.0 (where all works) the flowCurrentChunkSize of the last chunk size is less that chunk size, while in the master the last chunk has the size of a full chunk. |
okay, bug found, i'm preparing the patch :) when we implemented the read hook we moved the following code inside the preprocessFinished: // Compute the endByte after the preprocess function to allow an
// implementer of preprocess to set the fileObj size
this.endByte = Math.min(this.fileObj.size, (this.offset + 1) * this.chunkSize);
if (this.fileObj.size - this.endByte < this.chunkSize &&
!this.flowObj.opts.forceChunkSize) {
// The last chunk will be bigger than the chunk size,
// but less than 2*this.chunkSize
this.endByte = this.fileObj.size;
} but this would not work when the preprocess function is not defined, so i'm thinking a little on what can be the best solution. and i will also implement a test for the streaming capability that has not been unit tested so far. |
Ok @AidasK even if not part of this ticket i've referred this issue in the commit given the fact that we discussed it here. I will now proceed implementing the full example the testing for the streaming functionality. |
Thanks for fixing this! You can see released version here: https://github.com/flowjs/flow.js/releases/tag/v2.10.0 |
Hello,
I'm trying to get flow.js ready. This is how I've set up flow.js:
Everything works fine, except that the PHP script at
$uploadUrl
does only receive the following in $_FILES (var_dump()
'd at the first line, so nothing can interfere):So,
$_FILES['size']
and$_FILES['type']
is missing, which makes it an invalid upload. I'm using flowjs/flow-php-server on the server side. Note that$_FILES['error']
is0
, so this shouldn't be an error due to phpupload_max_size
etcThe request send to the server has the following payload (using Chrome):
Another jquery file upload librariy works well and the standard POST upload, too.
What am I doing wrong that prevents flow.js from sending the correct size and type?
The text was updated successfully, but these errors were encountered: