I see You just uploaded 1.2 version. But I'think I found another problem with flash upload. File id's from Flash are not always in sync with id's on JS side. Because of that Flash outputs "Main::getFileById File not found" error when xFileStart is called from JS and in consequence progress meter for this file is not updated.
I think it happens when selecting file fails (eg. maxfilesize is exceeded) and Flash calls select callback:
select: function (files){
this.addFiles(files[0]);
this.nCurrentUploads = files[0].length;
}.bind(this),
In that case files[0] is null so DropZone.addFiles does nothing but in Flash File.id is incremented on every File object creation - whether file is valid or not.
Then user selects another file (this time file is valid) and this file in Flash has id = 2 (or 1 after your recent changes) and in JS has id = 0.
So next calls to Flash like:
Swiff.remote(this.flashObj.toElement(), 'xFileStart', i);
or callbacks from Flash like fileProgress or fileComplete
will fail because of ID mismatch.
I've fixed this by storing flashid variable in File object created in addFiles and then using this variable in calls to Flash e.g.
Swiff.remote(this.flashObj.toElement(), 'xFileStart', f.flashid);
and in callbacks (fileProgress, fileComplete) insted of:
var file = this.fileList[r[0].id];
i'm using following code
fileComplete: function (r) {
var file = null;
this.fileList.each(function (item) {
if (item.flashid == r[0].id) {
file = this.fileList[item.id];
}
}.bind(this));
}
Maybe not optimal :) but works for me.
And another thing - if selecting file in Flash fails the onSelectError event is not fired so I modified select callback like this:
select: function (files){
if (files[0] != null) {
this.addFiles(files[0]);
this.nCurrentUploads = files[0].length;
}
if (files[1] != null) {
Array.each(files[1],function (item,index) {
this.fireEvent('onSelectError', ['maxfilesize', item.name, item.size]);
}.bind(this));
}
}.bind(this),
Sorry for not sending any diff for this but I have a lot of other changes required for what I'm currently working on but not related to general functionality of DropZone (which btw is great !)
I see You just uploaded 1.2 version. But I'think I found another problem with flash upload. File id's from Flash are not always in sync with id's on JS side. Because of that Flash outputs "Main::getFileById File not found" error when xFileStart is called from JS and in consequence progress meter for this file is not updated.
I think it happens when selecting file fails (eg. maxfilesize is exceeded) and Flash calls select callback:
In that case files[0] is null so DropZone.addFiles does nothing but in Flash File.id is incremented on every File object creation - whether file is valid or not.
Then user selects another file (this time file is valid) and this file in Flash has id = 2 (or 1 after your recent changes) and in JS has id = 0.
So next calls to Flash like:
or callbacks from Flash like fileProgress or fileComplete
will fail because of ID mismatch.
I've fixed this by storing flashid variable in File object created in addFiles and then using this variable in calls to Flash e.g.
and in callbacks (fileProgress, fileComplete) insted of:
i'm using following code
Maybe not optimal :) but works for me.
And another thing - if selecting file in Flash fails the onSelectError event is not fired so I modified select callback like this:
Sorry for not sending any diff for this but I have a lot of other changes required for what I'm currently working on but not related to general functionality of DropZone (which btw is great !)