File is not added to internal stored list in manual upload mode before onSubmitted #1106

Closed
KRTac opened this Issue Jan 23, 2014 · 14 comments

Projects

None yet

3 participants

@KRTac
KRTac commented Jan 23, 2014

Running uploadStoredFiles() in a submitted event for an added file doesn't add that file to the upload queue.

If I add files to fine uploader and run uploadStoredFiles(), then add one other file and in the submitted event for that file I run uploadStoredFiles() again, that file won't be added to the upload queue. So when the original files finish uploading, the file that is last added won't start it's upload and will have a status of undefined.

I think that when the submitted event runs, the file that it references must already have a SUBMITTED status and must be ready to be added to the upload queue.

@rnicholus
Member

Why are you invoking uploadStoredFiles inside of a callback?

@KRTac
KRTac commented Jan 23, 2014

Is there any other way to add a file to the upload queue?

@rnicholus
Member

What are you trying to do here exactly? Why are you using manual upload mode (autoUpload: false) in the first place? Where is this file you want to add to the "queue" coming from?

@KRTac
KRTac commented Jan 23, 2014

I add files with addFiles() to the uploader. I run uploadStoredFiles() and then I run addFiles() again while the previously added files are uploading and I want to add the new files to the upload queue so they begin uploading automatically after the original files are done.

Could I maybe temporarily enable autoUpload and then disable it after all the uploads are done?

@rnicholus
Member

Why don't you just set the autoUpload option to true (the default)? Then there is no need to ever call uploadStoredFiles.

@KRTac
KRTac commented Jan 23, 2014

Because I don't want the files to be uploaded automatically.

@rnicholus
Member

What logic are you using to determine when the files should be uploaded then? It's not clear from your explanation why you wouldn't want the files to be uploaded automatically.

@KRTac
KRTac commented Jan 23, 2014

If currently uploading is in progress newly added files should be added to the upload queue.

@rnicholus
Member

Please show me your uploader code. I'm still not sure why you don't simply let Fine Uploader manage the uploads based on the number of open connections.

@KRTac
KRTac commented Jan 24, 2014

https://gist.github.com/anonymous/69c5f6d51ee5d60bb988

As I already said, I don't want to upload files automatically, but if files are being uploaded and other files are added to the uploader, then add the new files to the upload queue so they can also be uploaded.

@rnicholus
Member

When autoUpload is set to false, Fine Uploader doesn't actually add the file to the internal list of "stored" files until after the onSubmitted callback is invoked. I'd have take some time to examine the related commits to determine why that is.

It probably makes sense to store the file internally if autoUpload is set to false before we invoke the onSubmitted callback (but after onSubmit). The rules are a bit different when autoUpload is set to true though. In that case, I think the current internal order of events is appropriate.

@rnicholus rnicholus was assigned Jan 24, 2014
@rnicholus rnicholus added this to the 5.2.3 milestone Jun 23, 2015
@rnicholus
Member

Will probably look into this as part of 5.2.3.

@rnicholus rnicholus added to fix 3 - Doing and removed 2 - Do labels Jun 23, 2015
@rnicholus rnicholus modified the milestone: 5.2.3, 5.3.0 Jul 6, 2015
@rnicholus rnicholus added a commit that referenced this issue Jul 10, 2015
@rnicholus rnicholus chore(build): inc build num 89aa5cb
@rnicholus
Member

@KRTac @bjornbos The fix for this is currently being staged in the develop branch as part of 5.3.0-5. Please let me know if this fixes your issue.

@rnicholus rnicholus added 5 - Done and removed 3 - Doing labels Jul 10, 2015
@bjornbos

Fixes it for me

@rnicholus rnicholus closed this in 773ad63 Aug 3, 2015
@rnicholus rnicholus removed the 5 - Done label Aug 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment