Click here to Skip to main content
15,887,083 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to create text file inside the folder in phonegap IOS and Android

function gotFS(fileSystem) {
                fileSystem.root.getFile("readme.txt", {create: true}, gotFileEntry, fail);
            }

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

            function gotFileWriter(writer) {
                writer.onwrite = function(evt) {
                    console.log("write success");
                };

                writer.write("some sample text");
                writer.abort();
                // contents of file now 'some different text'
            }


function onFileSystemSuccess(fileSystem) {
          console.log(fileSystem.name);
          var directoryEntry = fileSystem.root;
          
          directoryEntry.getDirectory($('.caseName_h').val(), {create: true, exclusive: false}, onDirectorySuccess, onDirectoryFail)

      }
      
      function onDirectorySuccess(parent) {
          console.log(parent);
      }

      function onDirectoryFail(error) {
          alert("Unable to create new directory: " + error.code);
      }

      function onFileSystemFail(evt) {
          console.log(evt.target.error.code);
      }
Posted
Updated 6-Jul-13 22:30pm
v2

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900