- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
I'm looking for a way to rename a picture taken from the camera. If any one could help me, I'll appreciate that!
// Camera 3rd party plugin website: https://github.com/01org/cordova-plugin-intel-xdk-camera document.addEventListener("intel.xdk.camera.picture.add",onSuccess); document.addEventListener("intel.xdk.camera.picture.busy",onSuccess); document.addEventListener("intel.xdk.camera.picture.cancel",onSuccess); function capturePhoto() { intel.xdk.camera.takePicture(50,false,"jpg"); } function onSuccess(evt) { if (evt.success === true) { // create image var image = document.createElement('img'); image.src=intel.xdk.camera.getPictureURL(evt.filename); image.id=evt.filename; //document.body.appendChild(image); getPictureList(); } else { if (evt.message !== undefined) { alert(evt.message); } else { alert("error capturing picture"); } } }
Thanks!
- Tags:
- HTML5
- Intel® XDK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you send the file to a webservice, how do you specify the name? Is it possible to rename there?
Dale
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If I'm not mistaken, you'll need the Cordova File Plugin to do that.
https://github.com/apache/cordova-plugin-file
http://www.html5rocks.com/en/tutorials/file/filesystem/
Hope this helps,
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi CHRIS Thanks for the tip, but I have tried and no success!
I have imported the plugin with success, but the code givemes a 'NOT_FOUND_ERR' .. Any idea?
Here is the code:
function rename(cwd, src, newName) { cwd.getFile(src, {}, function(fileEntry) { fileEntry.moveTo(cwd, newName); }, errorHandler); } window.requestFileSystem(window.TEMPORARY, 1024*1024, function(fs) { rename(fs.root, '/images/Arrow.png', 'you.png'); }, errorHandler); function errorHandler(e) { var msg = ''; switch (e.code) { case FileError.QUOTA_EXCEEDED_ERR: msg = 'QUOTA_EXCEEDED_ERR'; break; case FileError.NOT_FOUND_ERR: msg = 'NOT_FOUND_ERR'; break; case FileError.SECURITY_ERR: msg = 'SECURITY_ERR'; break; case FileError.INVALID_MODIFICATION_ERR: msg = 'INVALID_MODIFICATION_ERR'; break; case FileError.INVALID_STATE_ERR: msg = 'INVALID_STATE_ERR'; break; default: msg = 'Unknown Error'; break; }; alert('Error: ' + msg); }
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The filesystem on a mobile device is not like that on your PC or Mac, you cannot manipulate and rename files except where your app has specific permission and access. Where those places are is very limited and OS dependent. If you are trying to rename files that reside within your app's install location that will not work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Paul F. (Intel) wrote:
The filesystem on a mobile device is not like that on your PC or Mac, you cannot manipulate and rename files except where your app has specific permission and access. Where those places are is very limited and OS dependent. If you are trying to rename files that reside within your app's install location that will not work.
Hi Paul , I appreciate your reply!
Do you know another way to rename the file ?
The point is: I'll send these file to a webservice, but if we have a multiple phones, they are going to send the same name of the file... and I would like to rename it, and add some thing like the device id for example!
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you send the file to a webservice, how do you specify the name? Is it possible to rename there?
Dale
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you are using the FileTransfer plugin then specifying the file name the server will use is one of the options.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page