Yeppao
Yeppao

Reputation: 130

Can i upload a video to my server with PhoneGap or another API?

After having decided to use as PhoneGap API for the development of a small application, I tried to access the gallery of the phone to set up a system to upload files to my server. Unfortunately, when I go to the gallery, the pictures are only available ...

Is there a way to access the video and send to the server, or another API who change HTML code in native app ? Or should I use a service for sending mail. If yes, what is the name of this service?

Thanks to @ghostCoder

Just one correction, to be true :

navigator.camera.getPicture(successFn, errorFn, { quality: 50,
        destinationType: this.photoDestinationType.FILE_URI,
        sourceType: source,
        mediaType: navigator.camera.MediaType.ALLMEDIA  });

mediaType: this.fileMediaType.ALLMEDIA

replace by

mediaType: navigator.camera.MediaType.ALLMEDIA

Upvotes: 1

Views: 3954

Answers (1)

ghostCoder
ghostCoder

Reputation: 7655

yes u can upload videos too.

use this

navigator.camera.getPicture(successFn, errorFn, { quality: 50,
        destinationType: this.photoDestinationType.FILE_URI,
        sourceType: source,
        mediaType: this.fileMediaType.ALLMEDIA  });

this will open up gallery where u can choose a video too.

then u can upload it using

var ft = new FileTransfer();
var options = new FileUploadOptions();
    options.fileKey="document";
    options.params={};
    options.fileName =  fileName;
    options.params.fileName = options.fileName ;
    options.chunkedMode = true;
ft.upload(fileURI, uploadUrl, successFn, errorFn, options);

Upvotes: 3

Related Questions