Downloadify โ create downloads on the fly without server interaction
Author: Chris Heilmann
15
Dec
Downloadify is an interesting solution to offer files as downloads without having to create temporary files and loop through a script that sets a force-download header.
As shown in the demo page offering a file for download and setting its content is as easy as this:
JAVASCRIPT:
-
Downloadify.create('downloadify',{
-
filename: function(){
-
return document.getElementById('filename').value;
-
},
-
data: function(){
-
return document.getElementById('data').value;
-
},
-
onComplete: function(){
-
alert('Your File Has Been Saved!');
-
},
-
onCancel: function(){
-
alert('You have cancelled the saving of this file.');
-
},
-
onError: function(){
-
alert('You must put something in the File Contents or there will be nothing to save!');
-
},
-
swf: 'media/downloadify.swf',
-
downloadImage: 'images/download.png',
-
width: 100,
-
height: 30,
-
transparent: true,
-
append: false
-
});
As you can see you have callbacks for all the possibilities and several parameters to style the flash movie overlaying the real "download this" button. The only issue I can see is that it doesn't work by sending the form via keyboard. This needs fixing.
Related News :