Posted By

parkerkrhoyt on 11/04/11


Tagged

phone file native mobile write api device phonegap gap


Versions (?)

Use PhoneGap to Create a File


 / Published in: JavaScript
 

  1. window.requestFileSystem(
  2. LocalFileSystem.PERSISTENT,
  3. 0,
  4. function doAccess( fs ) {
  5. // alert( 'Got file access' );
  6.  
  7. fs.root.getFile(
  8. SOURCE,
  9. {
  10. create: true,
  11. exclusive: false
  12. },
  13. function( fe ) {
  14. reference = fe.fullPath;
  15. fe.createWriter(
  16. function( writer ) {
  17. // alert( 'Ready to write' );
  18.  
  19. writer.onwriteend = function( e ) {
  20. // alert( 'File written' );
  21. };
  22.  
  23. writer.write( ' ' );
  24. }
  25. );
  26. },
  27. function( err ) {
  28. // alert( 'No access to file entry' );
  29. }
  30. );
  31. },
  32. function( err ) {
  33. // alert( 'File system not responding' );
  34. }
  35. );

Report this snippet  

You need to login to post a comment.