This is a migrated thread and some comments may be shown as answers.

Save As - Button

3 Answers 80 Views
Apache Cordova
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Maxim
Top achievements
Rank 1
Maxim asked on 27 Aug 2012, 07:59 PM
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

3 Answers, 1 is accepted

Sort by
0
neven
Top achievements
Rank 1
answered on 30 Aug 2012, 11:57 AM
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>

0
Criulean
Top achievements
Rank 1
answered on 04 Sep 2012, 05:15 PM
Neven Thank you for your response but how to use this code for a button <a> ?
0
sdobrev
Top achievements
Rank 1
answered on 05 Sep 2012, 11:37 AM
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.
Tags
Apache Cordova
Asked by
Maxim
Top achievements
Rank 1
Answers by
neven
Top achievements
Rank 1
Criulean
Top achievements
Rank 1
sdobrev
Top achievements
Rank 1
Share this question
or