resolveLocalFileSystemURI failing with error.code 5 (ENCODING_ERR)

7,940 views
Skip to first unread message

ijwelch

unread,
May 29, 2011, 9:45:46 AM5/29/11
to phon...@googlegroups.com
Hi,

Phonegap 0.9.5
iOS 4.2.1

Any ideas why this call would result in error code 5?

var sPath='/var/mobile/Applications/80445699-37DC-42C2-B286-93893213E02C/Documents/63FAEC39-D63D-B128-CD72-620E93CD3F4F.jpg';
window.resolveLocalFileSystemURI(sPath, win, fail);

I've checked the obvious, and the file exists and loads ok in html.

I actually want to delete the file so the above call is to get a FileEntry object. 
This I gleaned from the 'docs' (under the title 'HOW TO CREATE A FileEntry OBJECT' - sorry that's a joke I just couldn't resist). 

So if there's another way to delete a file (given a file name) then cool.

Simon MacDonald

unread,
May 29, 2011, 11:53:55 AM5/29/11
to phon...@googlegroups.com
It's because you are not passing in a URI. Try:

var sPath='file:///var/mobile/Applications/80445699-37DC-42C2-B286-93893213E02C/Documents/63FAEC39-D63D-B128-CD72-620E93CD3F4F.jpg';
window.resolveLocalFileSystemURI(sPath, win, fail);

Simon Mac Donald
http://hi.im/simonmacdonald

> --
> You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com
>

ijwelch

unread,
May 29, 2011, 12:14:53 PM5/29/11
to phon...@googlegroups.com
perfect. thanks Simon.

Amulya Chowdary

unread,
Dec 9, 2013, 7:52:11 AM12/9/13
to phon...@googlegroups.com
Hi, Im trying this for video, but it is returning error code2. can anyone please help me. 
Thanks in advance.

testspi...@gmail.com

unread,
Oct 28, 2016, 4:07:13 PM10/28/16
to phonegap
Hi simon i am getting error code 6. any help with that??  
 function clearDirectory() {
var relativeFilePath = "file:///storage/C8F0-1207/DCIM/Camera/20161024_095758.mp4";
function success(entry) {
  console.log("Removal succeeded");
}

function fail(error) {
  console.log("Error removing file: " + error.code);
}
window.resolveLocalFileSystemURL(relativeFilePath, function(dir) {
 dir.remove(success, fail);
});
};
Reply all
Reply to author
Forward
0 new messages