Save As - Button

4 posts, 0 answers
  1. Maxim
    Maxim avatar
    2 posts
    Member since:
    Aug 2012

    Posted 27 Aug 2012 Link to this post

    How to save the image from a URL to SD card > onclick button "save " ?  I found a lot of phonegap code but i need to do it in icenium, please help
  2. neven
    neven avatar
    17 posts
    Member since:
    Nov 2010

    Posted 30 Aug 2012 Link to this post

    Hi,

    Below is an working example how to write to file system (sd card). This doesn't cover fully your question but is a good starting point:

    <!DOCTYPE html>
    <html>
      <head>
        <title>FileWriter Example</title>

        <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
        <script type="text/javascript" charset="utf-8">

        // Wait for Cordova to load
        //
        document.addEventListener("deviceready", onDeviceReady, false);

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

        function gotFS(fileSystem) {
            console.log(fileSystem.root.fullPath);
            fname="IceActionLog.txt";
            console.log("Full Path Name is  " + fname);
            fileSystem.root.getFile(fname, {create: true, exclusive: false}, gotFileEntry, fail);
        }
        
        function gotFileEntry(fileEntry) {
            fileEntry.createWriter(gotFileWriter, fail);
        }

        function gotFileWriter(writer) {
            writer.write("This is written on onDevice ready.");
        }

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

        </script>
      </head>
      <body>
        Testing onDeviceReady - writning to the file system
      </body>
        
        
    </html>

  3. Criulean
    Criulean avatar
    1 posts
    Member since:
    Aug 2012

    Posted 04 Sep 2012 Link to this post

    Neven Thank you for your response but how to use this code for a button <a> ?
  4. sdobrev
    sdobrev avatar
    54 posts
    Member since:
    Sep 2012

    Posted 05 Sep 2012 Link to this post

    Hi Criulean,

    You can use the click event of a kendo Button for this functionality. Here is the online reference for this. Here you can find an example which have source code.

    Hope this helps.
Back to Top