[ 
https://issues.apache.org/jira/browse/CB-12515?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16015911#comment-16015911
 ] 

Simon-Pierre Tessier commented on CB-12515:
-------------------------------------------

Hi Kerri,

I had the same problem with using Cordova and Filestack a third party uploader. 
As you stated, to determine if an object if a file, they call the 
Object.prototype.toString which is my case returned "[object Object]".

We were able to fix this with a dirty workaround (ie overriding the toString 
function of the file object)

fileEntry.file(function(fileEntryFile) {
    fileEntryFile.toString = () => '[object File]'; // This is a dirty 
workaround, please don't judge :P
    filestackClient.upload(fileEntryFile, {}, storeTo);
});

Hope this helps anyone facing this issue.

Regards,
SP

> Object.prototype.toString.call(file) returns [object Object] instead of 
> [object File]
> -------------------------------------------------------------------------------------
>
>                 Key: CB-12515
>                 URL: https://issues.apache.org/jira/browse/CB-12515
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-plugin-file
>            Reporter: Alexander Broekhuis
>
> I'm trying to use the File plugin in combination with FineUploader. 
> FineUploader uses the File API and tests if a passed in object is a file 
> using the following call:
> Object.prototype.toString.call(file) === "[object File]"
> But the File retrieved from a FileEntry using entry.file(function(file) { ... 
> }); is not seen as a file since the toString.call returns [object Object].



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to