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:
  1. Downloadify.create('downloadify',{
  2.   filename: function(){
  3.     return document.getElementById('filename').value;
  4.   },
  5.   data: function(){
  6.     return document.getElementById('data').value;
  7.   },
  8.   onComplete: function(){
  9.     alert('Your File Has Been Saved!');
  10.   },
  11.   onCancel: function(){
  12.     alert('You have cancelled the saving of this file.');
  13.   },
  14.   onError: function(){
  15.     alert('You must put something in the File Contents or there will be nothing to save!');
  16.   },
  17.   swf: 'media/downloadify.swf',
  18.   downloadImage: 'images/download.png',
  19.   width: 100,
  20.   height: 30,
  21.   transparent: true,
  22.   append: false
  23. });

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 :