plupload icon indicating copy to clipboard operation
plupload copied to clipboard

[plupload 3.1.2] getNative no longer works

Open Danoontjes opened this issue 6 years ago • 10 comments

I am trying to compute the SHA1 hash of a file before uploading it with plupload. There are some javascript implementations out there that are able to do that, but I need access to the blob of the file that gets selected in the plupload GUI. I have seen some examples (for plupload 2x) that use getNative() to get the blob. That no longer works with version 3.1.2 I get the following error:

Uncaught TypeError: this.getFile is not a function
    at r.getNative (plupload.full.min.js:29)
    at a.UploadFile (<anonymous>:29:23)
    at a.dispatchEvent (plupload.full.min.js:29)
    at a.trigger (plupload.full.min.js:13)
    at r.<anonymous> (plupload.full.min.js:29)
    at Array.<anonymous> (plupload.full.min.js:13)
    at n (plupload.full.min.js:13)
    at Object.d [as inSeries] (plupload.full.min.js:13)
    at r.dispatchEvent (plupload.full.min.js:13)
    at r.trigger (plupload.full.min.js:13)
    at r.<anonymous> (plupload.full.min.js:29)
    at Array.<anonymous> (plupload.full.min.js:13)
    at n (plupload.full.min.js:13)
    at Object.d [as inSeries] (plupload.full.min.js:13)
    at r.dispatchEvent (plupload.full.min.js:13)
    at r.trigger (plupload.full.min.js:13)
    at r.start (plupload.full.min.js:29)
    at r.upload (plupload.full.min.js:29)
    at r.start (plupload.full.min.js:29)
    at a (plupload.full.min.js:29)
    at a.start (plupload.full.min.js:29)
    at HTMLAnchorElement.<anonymous> (jquery.plupload.queue.js:315)
    at HTMLAnchorElement.dispatch (jquery-3.3.1.min.js:2)
    at HTMLAnchorElement.y.handle (jquery-3.3.1.min.js:2)

The code calling the function:

UploadFile : function (up, file) {
    var myfile = file.getNative();
},

Danoontjes avatar Apr 11 '18 12:04 Danoontjes

I also encountered this problem, how can I solve it?

cbbfcd avatar Jul 06 '18 08:07 cbbfcd

I could not solve it. I switched to http://www.resumablejs.com/

From: "波比小金刚" [email protected] To: moxiecode/plupload [email protected] Cc: StripeBanana [email protected], Author [email protected] Date: 06-07-2018 10:56 Subject: Re: [moxiecode/plupload] [plupload 3.1.2] getNative no longer works (#1560)

I also encountered this problem, how can I solve it? ― You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Danoontjes avatar Jul 06 '18 09:07 Danoontjes

@StripeBanana en~ thx!

cbbfcd avatar Jul 09 '18 02:07 cbbfcd

plupload v3.1.2

FilesAdded,but error: Uncaught TypeError: this.getFile is not a function

and plupload v2.3.6 is ok!

juvenrui avatar Aug 13 '18 14:08 juvenrui

I also encountered this problem, how can I solve it?

Seanxwy avatar Oct 19 '19 15:10 Seanxwy

plupload v3.1.2

use 'files[0].getSource().getSource()' instead of 'files[0].getNative()'

FilesAdded: function(up, files) {
    files[0].getSource().getSource()
}

shinn-lancelot avatar Apr 08 '20 05:04 shinn-lancelot

FilesAdded: function(up, files) { plupload.each(files, function(file,index) { var reader = new window.FileReader(); reader.readAsDataURL(files[index].getSource().getSource()); } }

revsmoke avatar Jun 16 '21 02:06 revsmoke

plupload v3.1.3 the Plupload.File object .getNative() fn still throws an uncaught TypeError "this.getFile is not a function".

files[0].getSource().getSource() chaining is not clear as to what will be returned whereas .getNative() on a Plupload.File object is much more succinct.

trenshaw avatar Sep 09 '21 00:09 trenshaw

Is it now possible? How to solve it

Chevsky-G avatar Oct 10 '23 06:10 Chevsky-G

@StripeBanana恩~谢谢! Is it now possible? How to solve it

Chevsky-G avatar Oct 10 '23 06:10 Chevsky-G