Hello,
can somebody help me with saving file into local disk
using javascript? I made some sample code which
unfortunately won't work :(.
Applet sample file:
Html sample file:
can somebody help me with saving file into local disk
using javascript? I made some sample code which
unfortunately won't work :(.
Applet sample file:
Code:
public class IO extends Applet {
public void write(String path, String data) {
try {
File file = new File(path);
DataOutputStream dos = new DataOutputStream(
new BufferedOutputStream(
new FileOutputStream(file)));
dos.writeBytes(data);
dos.close();
}
catch (SecurityException se) {
System.err.println(se.getMessage());
}
catch (IOException ioe) {
System.err.println(ioe.getMessage());
}
}
public void paint(Graphics g) {
}
}
Code:
<html>
<applet archive="IO.jar" code="IO.class" name="io" width="0" height="0"></applet>
<script type="text/javascript">
function saveText() {
document.applets[0].write("c:\\test.txt", "Hello World!");
}
saveText();
</script>
</html>
Comment