Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can we pass either DATA_URL or FILE_URI from Cordova’s to the first parameter of uploader.send?

Right now it seems that we need to pass the file object from an input with type="file"

Issue Analytics

  • State:open
  • Created 9 years ago
  • Comments:41 (10 by maintainers)

github_iconTop GitHub Comments

costinelmarincommented, Jan 28, 2016

None of the example work for me. The code below works for me on METEOR@1.3-cordova-beta.2 hope will help someone i don’t try on iOS simulator just on actual device.

function videoCaptureSuccess(mediaFiles) {

  var file = '/local-filesystem' + mediaFiles[0].fullPath;

  getBlobURL(file, "video/quicktime", function(url, blob){
    uploader.send(blob, function (error, downloadUrl) {

function getBlobURL(url, mime, callback) {
  var xhr = new XMLHttpRequest();"get", url);
  xhr.responseType = "arraybuffer";

  xhr.addEventListener("load", function() {
    var arrayBufferView = new Uint8Array( this.response );
    var blob = new Blob( [ arrayBufferView ], { type: mime } );
    var url = window.URL.createObjectURL(blob);

    callback(url, blob);
kevohagancommented, Jul 29, 2015

For future reference this is what i did , i had to recreate the file object from media-capture plugin with resolveLocalFileSystem

      captureSuccess = (mediaFiles) ->

        path = mediaFiles[0].fullPath
        window.resolveLocalFileSystemURL path, (fileEntry)->


            reader = new FileReader()

            reader.onloadend = (e)->
              blob = b64toBlobAlt(, 'video/mp4')
              console.log blob

              if blob
                uploader = new Slingshot.Upload('myVideoUpload')
                uploader.send blob, (error, downloadUrl) ->
                  if error
                    console.error 'Error uploading', uploader.xhr.response
                    console.log downloadUrl
                    Meteor.users.update Meteor.userId(), $set: 'profile.videoUrl': downloadUrl




Read more comments on GitHub >

github_iconTop Results From Across the Web

Cordova: Getting a file Uri from a content Uri - Stack Overflow
I found the problem. I'm using Ionic and Ionic View for test in device. When I tried the cordova-plugin-filepath it didn't work.
Read more >
cordova -plugin-file. This plugin implements a File API allowing read/write access to files residing on the device. This plugin is based on several...
Read more >
Dealing with Android content URIs in a Cordova based project
The cordova-filechooser plugin uses the ACTION_GET_CONTENT intent to select files from your app. The URI that this plugin returns when you ...
Read more >
FILE URI Not showing in <img> tag - Android #340 - GitHub
When selecting an image from the users library, the file URI returns /storage/emulated/0/Pictures/IMG_20180911_114705.jpg.
Read more >
cordova-plugin-filepath-generic - npm
Resolve native file paths from content URLs for Cordova platforms. ... of uri received. then it returns the filepath of the temporary file....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found