Uploading Images Not working

1

I'm using cordova to pass my application WEB to Android . In my web application I upload images using the basic HTML tags <ipnut type='file' > . when I install the application in Android I can not upload images anymore.

Has anyone ever had a similar experience?

    
asked by anonymous 08.08.2017 / 17:01

1 answer

1

There is a difference, we first need to understand what is working, but following.

You can, however, have a <input type="file"> for uploading the photo, but I recommend that you use% a of% Camera .

You can use the FileTransfer to send the image to the server.

Accessing Plugin

navigator.camera.getPicture(uploadPhoto, function(message) {
 alert('Erro ao enviar');
 }, {
 quality: 100,
 destinationType: navigator.camera.DestinationType.FILE_URI,
 sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY
 });

Upload to server.

var ft = new FileTransfer();
 ft.upload(imageURI, "SUA URL", function(result){
 console.log(JSON.stringify(result));
 }, function(error){
 console.log(JSON.stringify(error));
 }, options);
    
26.09.2017 / 19:30