sroze / backbone-upload-manager

An upload manager written using Backbone.js
105 stars 35 forks source link

fileUploadFail event is firing even after the files are successfully sent to the server causing the whole page to refresh after. #1

Closed carlworx closed 11 years ago

carlworx commented 11 years ago

File: backbone.upload-manager.js Function: Backbone.UploadManager.bindProcessEvents()

this.uploadProcess.on('fileuploadfail', function (e, data) { $.each(data.uploadManagerFiles, function (index, file) { var error = "Unknown error"; if (typeof data.errorThrown == "string") { error = data.errorThrown; } else if (typeof data.errorThrown == "object") { error = data.errorThrown.message; } else if (data.result) { if (data.result.error) { error = data.result.error; } else if (data.result.files && data.result.files[index] && data.result.files[index].error) { error = data.result.files[index].error; } else { error = "Unknown remote error"; } } self.trigger('filefail', file, error); }); })

Description:

'fileuploadfile' is firing event even if the file was successfully posted to the server. data.state is "error" and data.message says something like Uploaded bytes is more than maximum size.

The whole page refreshes after thus not showing the error on the file view.

sroze commented 11 years ago

Why the page is refreshing ? It shouldn't and backbone-upload-manager code can't cause that behaviour... If data.message contains an error message, "Unknown remote error" should be 2nd argument of filefail event listener.

sroze commented 11 years ago

@carlworx any news ?

carlworx commented 11 years ago

@sroze

apologies for the delayed response, I tried it on another page and it worked, I could not replicate the error so it must be some other code that is causing this. Marking this issue as closed. Thanks. :)

carlworx commented 11 years ago

BTW, how do I use the upload manager without the deffered-view-loader?

I want to be able to just use my templates located at the same page.

sroze commented 11 years ago

Well, I think that's not possible right now, I (or we) need to change some things. I purpose that you create an other issue for that point, I'll do that in few days (but maybe more than 1 week). If you can send me a pull request that allow to use defered-view-loader but don't force, I would be thanking !