2012-03-29 14 views

Antwort

4

Für in der SD-Karte gespeichert ......

function save(){ 

    document.addEventListener("deviceready", onDeviceReady, false); 
} 



    // PhoneGap is ready 
    // 
    function onDeviceReady() { 
     window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail); 
    } 

    function gotFS(fileSystem) { 
     fileSystem.root.getFile("pic.jpg", {create: true, exclusive: false}, gotFileEntry, fail); 
    } 

    function gotFileEntry(fileEntry) { 
     fileEntry.createWriter(gotFileWriter, fail); 
    } 

    function gotFileWriter(writer) { 

     var photo = document.getElementById("image"); 
     writer.write(photo.value); 

    } 

    function fail(error) { 
     console.log(error.code); 
    } 
Verwandte Themen