aspose file tools*
The moose likes I/O and Streams and the fly likes using jsp to copg files from a directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "using jsp to copg files from a directory" Watch "using jsp to copg files from a directory" New topic
Author

using jsp to copg files from a directory

Yinka Olicks
Greenhorn

Joined: Aug 28, 2004
Posts: 12
hi ranchers,
pls I am writing an application using jsp and tomcat1.4,the application is supposed to connect to a database(oracle),pick up the path to a file,which is stored as a string in a table in the database,then follow the path and copy the file into a seperate folder,the connection to the database and picking up of the path I can do but,following and copying the file on to a different folder I cant pls how do I accomplish this
thanks
thanks I need to copy from the server to the client machine
[ August 17, 2005: Message edited by: Yinka Olicks ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61747
    
  67

Assuming that your intention is to copy the files around on the server (and not the client), you'd just use plain old Java I/O like any other files.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Yinka Olicks
Greenhorn

Joined: Aug 28, 2004
Posts: 12
tanks I am copying from server to a client machine and how can is it possible to use http to copy files with jsp thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61747
    
  67

That you cannot do. Imagine a world where any random web page that you visit could write whatever it wanted to your system. Scary, no?

What you can do is to provide a link to the file that the user can click and download at his or her discretion.
[ August 17, 2005: Message edited by: Bear Bibeault ]
Yinka Olicks
Greenhorn

Joined: Aug 28, 2004
Posts: 12
thanks,but what if I just want to use jsp to copy from a system on the network to another system within the network,please how do I go about that thanks
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

There is nothing specific in JSP for moving files.
There are APIs in Java for dealing with files (java.io.*) and there are various libraries available for dealing with FTP, and networking in general.
IE: http://jakarta.apache.org/commons/net/

Your approach will depend on factors such as OS you're running, what kind of network you have, and your applications specific requirements.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61747
    
  67

Moved to the I/O forum.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: using jsp to copg files from a directory