How to upload pdf file using cordova instead of png/jpg


#1

I am able to upload png/jpg files from gallery but when i select pdf file nothing is happening.I am using below code to select file from gallery.

  var options =   {
        quality: 50,
        destinationType: Camera.DestinationType.FILE_URI,
        sourceType: 0,      // 0:Photo Library, 1=Camera, 2=Saved Photo Album
        // encodingType: 0 ,    // 0=JPG 1=PNG
        correctOrientation: true
    }
    navigator.camera.getPicture(onSuccess,onCancel,options);

How can i check the selected file size.


#2

Hmm, if your using the cordova file transfer plugin, I don’t believe it supports pdf’s, AFAIK.


#3

I am using ng cordova its supports i am able to send files to server using this …but how can i read file size…is any property in ngcordova.


#4

it’s called the Camera plugin for a reason. It can only handle images as far as I can tell. There is http://devdocs.io/cordova/cordova_plugins_pluginapis.md#Plugin%20APIs
the file transfer api https://github.com/apache/cordova-plugin-file-transfer/blob/master/doc/index.md and the filesystem api https://github.com/apache/cordova-plugin-file/blob/master/doc/index.md


#5

how to send pdf or doc files to remote server…
any plugin…for android…
please give me detailed solution…
I can send only image and videos to server