addFile() not working with Pluplod's own file objects #756

Closed
srissel opened this Issue Apr 3, 2013 · 1 comment

Comments

Projects
None yet
2 participants
@srissel

srissel commented Apr 3, 2013

If feeding files from a second Plupload instance (let's say an arbitrary one) into another (let's say the main one) Plupload instance, no files are added actually.

this.mainUploader.addFile(uploaderArbitrary.files);

The reason is:
Method addFile() calls local function resolveFile(file). This determines the file's type by

o.typeOf(file)
which in the upper case returns "object".
This case is not covered by resolveFile() method.

Suggestion:
Introduce new case to extract native file from plupload file object:

function resolveFile(file) {
var type = o.typeOf(file);

if (file instanceof o.Blob) {
    ...
} else if (type === 'file') {
  ...
} else if (type === 'object' && file.getSource() && file.getSource().getSource()) {
 /* this is the new case */
 /* we call ourselves again, with the native file object */
                resolveFile(file.getSource().getSource());
} else if (type === 'node' && o.typeOf(file.files) === 'filelist') {
    ...
} else if (type === 'array') {
    ...
}

}

Kind regards,
Sascha.

@jayarjo

This comment has been minimized.

Show comment Hide comment
@jayarjo

jayarjo Apr 3, 2013

Owner

Obvious omission.

Owner

jayarjo commented Apr 3, 2013

Obvious omission.

@jayarjo jayarjo closed this in d0732bd Apr 5, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment