2

I am writing a small application in jquery mobile and phonegap to upload file (doc, pdf, or txt and not image) from card to server.

Images I can upload using

navigator.camera.getPicture()

which trigger gallery and i can select image and upload.

but at a different place I need to upload doc, pdf or txt files, i wish i can trigger file browser somehow and select file from there.

Any help will be much appreciated.

Pawan
  • 517
  • 1
  • 9
  • 25

1 Answers1

0

FileTransfer is an object that allows you to upload files to a server or download files from a server.

Use in conjunction with FileSystem, or play around with mediaType: navigator.camera.MediaType.ALLMEDIA option of getPicture perhaps.

soulseekah
  • 8,770
  • 3
  • 53
  • 58
  • Thanks soulseekah... but i need to trigger "File browser" of some kind to reach to file... i am stuck there :( – Pawan Dec 13 '12 at 10:27
  • There is no such thing in Cordova/Phonegap, you'll have to implement it yourself. There's no standard file select dialog in the SDK even, for inspiration you can use http://stackoverflow.com/questions/3592717/choose-file-dialog, http://code.google.com/p/android-file-dialog/ and wrap it into a Phonegap/Cordova plugin, which you can then opensource and maybe have it added to Phonegap/Cordova core. – soulseekah Dec 13 '12 at 10:36