java - Phonegap Cordova Delete File (android) -


hello ..

I'm new in the phone ..

I Android There was a problem deleting the file in PhoneGrap 3.4

  console.log (photo); window.requestFileSystem (FileSystem.root.getFile {photoSystem.root.getFile (file, {create: false}, function gotFileEntry (fileEntry) {fileEntry.remove ();}, onError);} at window.requestFileSystem (LocalFileSystem.PERSISTENT, 0, , OnError);   

log result

04-24 16: 29: 54.234: i / web console (16213): file: /// storage / sdcard0 / DCIM / camera / 1398331773136.jpg

04-24 16: 49: 01.989: W / Systems. Er (18864): org.apache.cordova.file.EncodingException: There is an invalid ":" in this path.

04-24 16: 49: 01.994: W / System.ARR (18864): at org.apache.cordova.file.LocalFilesystem.getFileFolLocalURL (localfilysystem.jewai -59)

04-24 16: 49: 01.994: W / Systems. Er (18864): at org.apache.cordova.file.FileUtils.getFile (FileUtils.java:698)

04-24 16:49: 03.664: I / Web Console (18864): 5 < / P>

After searching, I found this (error code and list of meaning) in the Doc

5 = ENCODING_ERR

The file path is incorrect and to file in sdcard How to get a valid path for

thanks

I think your problem callback The way to call the function is in the way. This code is working for me:

  console.log ("Remove File"); Var relativeFilePath = "MyDir / file_name.png"; window.requestFileSystem (localFileSystem.PERSISTENT, 0, function (file system) {fileSystem.root.getFile (relativeFilePath, {create: false}, function (file entry) {fileEntry.remove (function (file) {console.log (" File deleted! ");}, Function () {console.log (" Error deleting file "; error.code);})}}, function () {console.log (" file does not exist ") ;});}, Function (evt) {console.log (evt.target.error.code);});    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -