Results 1 to 11 of 11
Thread: Download File from the server
- 04-20-2010, 07:58 PM #1
Member
- Join Date
- Aug 2009
- Posts
- 51
- Rep Power
- 0
- 04-21-2010, 05:02 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
This is a forum, not a place to get your work done. So you MUST put some effort first of all. If you stuck on something then ask it here more clearly.
- 04-21-2010, 07:25 PM #3
Member
- Join Date
- Aug 2009
- Posts
- 51
- Rep Power
- 0
Hi
I actually did try and I am not getting my work done here. I converted a JTable to an excel file on the web server. But now I want to download that file from the server on the local system where the program is running on the server. I would really appreciate the help.
- 04-21-2010, 09:16 PM #4
Senior Member
- Join Date
- Mar 2010
- Posts
- 953
- Rep Power
- 4
Show us what you tried, and tell us how it is failing.
-Gary-
- 04-21-2010, 10:05 PM #5
Member
- Join Date
- Aug 2009
- Posts
- 51
- Rep Power
- 0
Ftp ftp = new Ftp();
ftp.setLocalDir(new File("C:\\"));
ftp.setDir("/export/home/project/public_html/meriproject");
ftp.setBinary();
ftp.upload(new File("/export/home0/project/meriproject2"));
ftp.download("results.xls");
I am using a class FTP which I have imported using a jar file. Now the thing is that this would be used when I am trying to access the the server from a local system. But its the other way around I am trying to dowanload the file from the server to the local system and the code is running on the server.
- 04-21-2010, 10:16 PM #6
Senior Member
- Join Date
- Mar 2010
- Posts
- 953
- Rep Power
- 4
Java can't do that (and we wouldn't want it to). Code running on a server can't arbitrarily write files on a client's file system. The client needs to download the file. In this case, it sounds like the client is a web browser, so you either just display a hyperlink and let the user click on it, or you try to automate it with JavaScript (which is not Java, and is outside the scope of this forum).
-Gary-
- 04-21-2010, 10:19 PM #7
Member
- Join Date
- Aug 2009
- Posts
- 51
- Rep Power
- 0
So you mean there is no way a file can be downloaded on the clients machine. I know that is one of the mail restrictions in applet, but there has to be some way of downloading the file on the system.
- 04-21-2010, 10:55 PM #8
Senior Member
- Join Date
- Mar 2010
- Posts
- 953
- Rep Power
- 4
Sure a file can be downloaded, but a server can't make it happen. It has to be done by a client. And if the client is a web browser, that means either the user does it by clicking a link, or it's done in JavaScript.
-Gary-
- 04-22-2010, 01:48 AM #9
Senior Member
- Join Date
- Mar 2010
- Posts
- 953
- Rep Power
- 4
Sorry -- you did say applet, and it is possible for an applet to write to the local file system, as long as it's signed code or uses JNLP.
JNLP API (The Java™ Tutorials > Deployment > Doing More With Rich Internet Applications)
-Gary-
- 04-22-2010, 04:13 AM #10
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
You can download files, sure. But you cannot do that in a server. Say you login to the server and try to download a file, then that end works as a client. If you want to download from someone else machine, then your end should work as a client. Server cannot do that.
- 04-22-2010, 04:14 AM #11
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Search on our forum. You can fine lots of related stuff for file downloading using Java.
Similar Threads
-
How to show or open a file download or file save dialog box
By java_bond in forum New To JavaReplies: 0Last Post: 03-05-2010, 04:21 AM -
how to download file from ftp server
By santhosh_el in forum NetworkingReplies: 0Last Post: 11-19-2009, 06:01 AM -
Download file from URL?
By makpandian in forum New To JavaReplies: 0Last Post: 03-10-2009, 12:30 PM -
Download from other server
By javaism in forum Web FrameworksReplies: 1Last Post: 09-06-2008, 08:24 PM -
image download from server
By willemjav in forum Java AppletsReplies: 2Last Post: 04-03-2008, 10:13 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks