3

I'm trying to upload a file from a phonegap app on my blackberry device to my lamp server. I followed the tutorials below and they do what the author expects them to do:

http://docs.phonegap.com/en/1.0.0/phonegap_file_file.md.html#FileTransfer http://zacvineyard.com/blog/2011/03/25/upload-a-file-to-a-remote-server-with-phonegap/

However, the tutorials do not achieve my objective. The problem is that the only file I'm allowed to upload is a picture that I immediately take with the camera. I am not able to browse my Blackberry device for other pictures, audio files, text files and "choose" them.

How do I modify the code in the above examples to allow me to choose a file for upload? Am I overlooking something?

John
  • 32,403
  • 80
  • 251
  • 422

2 Answers2

4

Phonegap - Choose Image From Gallery

As Ben Poole says:

Erm, the Camera docs cover this. Is this not working for you?

If Camera.sourceType = Camera.PictureSourceType.PHOTOLIBRARY or Camera.PictureSourceType.SAVEDPHOTOALBUM, then a photo chooser dialog is shown, from which a photo from the album can be selected.

http://docs.phonegap.com/phonegap_camera_camera.md.html

You don't have to write your own file manager system, i would vote down Martinez's answer if i could.

Community
  • 1
  • 1
igrek
  • 1,415
  • 1
  • 12
  • 27
1

If that code snippet is all you have used, then you have indeed, overlooked some key areas. You should probably start with this and work towards your goal. I would start by writing a simple file manager type app.

  1. Enumerate the entire sdcard or storage tree.

  2. When you find the directory you'd like to enter, enter and enumerate it's contents

  3. Define a method to select files and upload them.

Martinez
  • 484
  • 2
  • 4