aspose file tools*
The moose likes Java in General and the fly likes Downloading the document Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Downloading the document" Watch "Downloading the document" New topic

Downloading the document

prasanth chiru

Joined: Mar 14, 2004
Posts: 16
I am developing a web site in which we have a button "Download" in a document, which downloads that document and stores on the clients machine. If anybody has done this earlier or anybody has idea about this please help me.
Prabhu Chandrasekaran
Ranch Hand

Joined: Oct 14, 2000
Posts: 36
Hi Prashant,
Check This Code Out
class filecopy
static FileInputStream fin;
static FileOutputStream fout;
public static void main(String args[]) throws IOException
int i;
fin=new FileInputStream(args[0]);
fout=new FileOutputStream(args[1]);
catch(Exception ex)
System.out.println("File is Being Copied. Pl. Wait ....\n\n\n\n");
if(i != -1)
fout.write((char) i);
while(i != -1);
This program is for copying a file to another name using streams. See if the code solves your problem.
Note : The names of the files are got as arguments in this program.
Post your results back here.

I agree. Here's the link:
subject: Downloading the document