File url to the file located in the Documents folder in the iOS phonegap application?

what does the url file for the file under the document folder in the iOS application for the mobile phone do, as if I need to link to it in my html file?

+4
source share
3 answers
getAbsolutePath("mead.jpg", function(entry){ //alert(entry.fullPath); $("#img_test").attr("src",entry.fullPath); console.log("jq$:=" + entry.fullPath); //$("#img_test").attr("src","img/test.jpg"); }); // file system function getAbsolutePath(file_name,call_back){ var full_path = ""; window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (file_system){ file_system.root.getFile( file_name, {create: false}, call_back , function(){ console.log("failed to fetch file, please check the name"); } ); }, function(){ console.log("failed file sytem"); } ); } 
+2
source

The www folder in your phonegap project is the root. therefore, for example, image.png is added to this folder

 <img src="image.png" /> 
0
source

I refer to the images stored in the document folder as follows: /var/mobile/Applications/21F126D3-D345-490D-91C6-7619CC682944/Documents/'name'.jpg

The part with letters and numbers is individual for each application, so yours will be different. You can get this with:

  window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSys) { var pathToRoot = fileSys.root.fullPath; }, function() { console.log('****iPhone:Error when requesting persisten filesystem to find root path.'); }); 

This is explained in the telephone documents .

0
source

All Articles