0

I'm using Phonegap to 1. capture a photo, 2. display the photo, 3. upload the photo. #1 and #2 are working.

For #3, I'm trying to use the FileTransfer.upload method to POST the captured photo to a Domino document (as an attachment in Rich Text?). The Phonegap API documentation explains ways to do this with PHP (sending request to a upload.php page), but I'm trying do accomplish this with an XPages/SSJS/Java solution. Was wondering if anyone has done something similar? Phonegap example is posted below. Thanks for any suggestions.

var options = new FileUploadOptions();
options.fileKey="file";
options.fileName=fileURI.substr(fileURI.lastIndexOf('/')+1);
options.mimeType="text/plain";

var params = new Object();
params.value1 = "test";
params.value2 = "param";

options.params = params;

var ft = new FileTransfer();
ft.upload(fileURI, "http://some.server.com/upload.php", win, fail, options);
Ryan Buening
  • 1,559
  • 2
  • 22
  • 60

1 Answers1

1

In your receiving XPage you should get the posted data as input stream like this:

facesContext.getExternalContext().getRequest().getInputStream()

Then you can save it to a document like this:

Temporary folder for attachments

Community
  • 1
  • 1
Panu Haaramo
  • 2,932
  • 19
  • 41