Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

Pause file upload in case of network disconnection/unresponsive server #1974

Open
2 tasks done
awaistune opened this issue Feb 26, 2018 · 2 comments
Open
2 tasks done

Comments

@awaistune
Copy link

awaistune commented Feb 26, 2018

Type of issue

  • Bug report

Uploader type

  • Traditional
Bug Report

Fine Uploader version

5.5.1

Browsers where the bug is reproducible

chrome

Operating systems where the bug is reproducible

Ubuntu 16.10

Exact steps required to reproduce the issue

For example:

  1. select a file
  2. disconnect upload server or network connection.
  3. Pause a file on error/on status change.

All relevant Fine Uploader-related code that you have written

uploadComponent.fineUploader.on('StatusChange',(id,oldStatus,newStatus)=> {
var uuid = this.fineUploader.methods.getUuid(id)
console.log('oldStatus',oldStatus)
console.log('newStatus',newStatus)
if(newStatus=='upload failed')
{
uploadComponent.fineUploader.methods.pauseUpload(id)
console.log('pauseUpload')
}

			})

uploadComponent.fineUploader.on('error',(id,name,errorReason,xhr)=> {
// console.log(id)
console.log(name)
console.log(errorReason)
console.log(xhr)
var uuid = this.fineUploader.methods.getUuid(id),
event = document.getElementById(uuid).querySelector(".playPauseIcon")
if(event&&xhr.status==0)
{
event.classList.add("playIcon");
// uploadComponent.fineUploader.methods.pauseUpload(id)
// console.log('pauseUpload')
event.querySelector('i').classList.remove('icon-stop2');
event.querySelector('i').classList.add('icon-playicon');
}
// console.log(xhr)
})

Detailed explanation of the problem

I want to pause the uploader onError/onStatusChange event in case of server code 0 but the uploader is throwing exception

Ignoring pause for file ID 0 (out2.mp4). Not in progress.

Please guide me how can i pause the File in case of server/network disconnection

@rnicholus
Copy link
Member

Why do you want to pause a failed upload? Just retry it manually after it fails

@awaistune
Copy link
Author

awaistune commented Feb 27, 2018

If i retry it manually it will throw same error after each retry. I want to give this control to user so that user can check his/her connection in that time. Also on onError event why uploader calls total progress event. This happens when file exceeds total file size , Invalid extension/type. First status changed from submitting to rejected below is the debug log


> uploader_left_fine.vue?2c3e:519 newStatus submitting
> fine-uploader.core.js?b73f:162 [Fine Uploader 5.15.6] Received 1 files.
> fine-uploader.core.js?b73f:162 [Fine Uploader 5.15.6] onValidateBatch - waiting for onValidateBatch promise to be fulfilled for batch validation
> fine-uploader.core.js?b73f:162 [Fine Uploader 5.15.6] onValidateBatch promise success for batch validation
> fine-uploader.core.js?b73f:162 [Fine Uploader 5.15.6] onValidate - waiting for onValidate promise to be fulfilled for Item 'linux-image-extra-4.8.0-59-generic_4.8.0-59.64_amd64.deb', size: 37408736
> fine-uploader.core.js?b73f:162 [Fine Uploader 5.15.6] onValidate promise success for Item 'linux-image-extra-4.8.0-59-generic_4.8.0-59.64_amd64.deb', size: 37408736
> uploader_left_fine.vue?2c3e:536 linux-image-extra-4.8.0-59-generic_4.8.0-59.64_amd64.deb
> uploader_left_fine.vue?2c3e:537 linux-image-extra-4.8.0-59-generic_4.8.0-59.64_amd64.deb has an invalid extension. Valid extension(s): wmv, avi, divx, 3gp, mov, mpeg, mpg, xvid, flv, asf, rm, dat, mp4, mkv, m4v, f4v, dat, webm, ogv.
> fine-uploader.core.js?b73f:165 [Fine Uploader 5.15.6] Caught exception in 'onTotalProgress' callback - Cannot read property 'length' of null
> qq.log @ fine-uploader.core.js?b73f:165
> log @ fine-uploader.core.js?b73f:1207
> safeCallback @ fine-uploader.core.js?b73f:2344
> self._options.callbacks.(anonymous function) @ fine-uploader.core.js?b73f:2353
> _onTotalProgress @ fine-uploader.core.js?b73f:2115
> (anonymous) @ fine-uploader.core.js?b73f:460
> callbackProxy @ fine-uploader.core.js?b73f:5092
> updateTotalProgress @ fine-uploader.core.js?b73f:5135
> onCancel @ fine-uploader.core.js?b73f:5106
> onStatusChange @ fine-uploader.core.js?b73f:5141
> (anonymous) @ fine-uploader.core.js?b73f:1472
> setTimeout (async)
> onStatusChange @ fine-uploader.core.js?b73f:1471
> setStatus @ fine-uploader.core.js?b73f:959
> _fileOrBlobRejected @ fine-uploader.core.js?b73f:1629
> (anonymous) @ fine-uploader.core.js?b73f:2307
> (anonymous) @ fine-uploader.core.js?b73f:741
> qq.each @ fine-uploader.core.js?b73f:428
> failure @ fine-uploader.core.js?b73f:740
> _validateFileOrBlobData @ fine-uploader.core.js?b73f:2311
> _onValidateCallbackSuccess @ fine-uploader.core.js?b73f:2165
> (anonymous) @ fine-uploader.core.js?b73f:460
> (anonymous) @ fine-uploader.core.js?b73f:1750
> Promise resolved (async)
> _handleCheckedCallback @ fine-uploader.core.js?b73f:1748
> _onValidateBatchCallbackSuccess @ fine-uploader.core.js?b73f:2142
> (anonymous) @ fine-uploader.core.js?b73f:460
> (anonymous) @ fine-uploader.core.js?b73f:1750
> Promise resolved (async)
> _handleCheckedCallback @ fine-uploader.core.js?b73f:1748
> _prepareItemsForUpload @ fine-uploader.core.js?b73f:2178
> addFiles @ fine-uploader.core.js?b73f:1073
> _onInputChange @ fine-uploader.core.js?b73f:2071
> onChange @ fine-uploader.core.js?b73f:1502
> (anonymous) @ fine-uploader.core.js?b73f:807

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants