PhoneGap 2.5 - FileTransfer options filename issue

One short missing documentation hint concerning the filename. If using Camera.PictureSourceType.SAVEDPHOTOALBUM you have, at least on Android, to distinguish for FileUploadOptions. If using CAMERA as source type with Camera.DestinationType.FILE_URI the options.filename is not needed for transferring correctly. Check following code snippet:

function onCaptureSuccess(imageURI) {      

  var options = new FileUploadOptions();
  if (currentSourceType === Camera.PictureSourceType.CAMERA) {
    var end = imageURI.lastIndexOf('/') + 1;
    options.fileName = imageURI.substr(end);
  }

Edit (08/2013): At least in 2.9 this issue does not longer exits, no needed use substr!!

No comments:

Post a Comment