Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Downloading the document

Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

them good ole boys were drinking whiskey and rye singin' this'll be the day that I die. Drink tiny ad.
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!