artuska opened a new issue #260: File becomes [object Object] in FormData
URL: https://github.com/apache/cordova-plugin-file/issues/260
 
 
   The File object i get from the cordova-plugin-file in my Cordova application 
is not the same as File i get in browser (for example in FileList when i choose 
files from <input type="file">).
   
   ```
   // i use cordova-plugin-filechooser to select a file 
   
   window.fileChooser.open((uri: string) => {
   
       // `uri` is a `content://...`
   
       window.FilePath.resolveNativePath(uri, (path: string) => {
    
           // `path` is a `file://...`
   
           window.resolveLocalFileSystemURL(path, (entry: FileEntry) => {
               entry.file((file: File) => {
                   let fd = new FormData();
   
                   fd.append('image', file);
   
                   console.log(fd.get('image'));
                   console.log(fd.getAll('image'));
               });
           });
       });
   });
   ```
   
   Console.log outputs:
   
   ```
   [object Object]
   ["[object Object]"]
   ```
   
   but it should be:
   
   ```
   File(36244)
   [File(36244)]
   ```
   
   Here is cordova-plugin-file File object:
   <img width="505" alt="screen shot 2018-10-03 at 18 15 15" 
src="https://user-images.githubusercontent.com/1013856/46453512-92704880-c7aa-11e8-8a2b-6231e195cf36.png";>
   
   Here is normal File object:
   <img width="512" alt="screen shot 2018-10-03 at 18 10 23" 
src="https://user-images.githubusercontent.com/1013856/46453523-9d2add80-c7aa-11e8-9056-9e0f78d73bdb.png";>
   
   How can i get normal File to use it in FormData? I need this to send files 
to the server.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to