cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon-Pierre Tessier (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-12515) Object.prototype.toString.call(file) returns [object Object] instead of [object File]
Date Thu, 18 May 2017 15:11:04 GMT

    [ 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: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message