Forums Register Login

To read list of files from server

+Pie Number of slices to send: Send
Hi,
Please help me out with some solutions.
One of the application will upload some files to some particular directory on the server.I need to read the list of those uploaded files
from the server.Can anyone provide me with some smaple code on how to read the file names from the server.
Thanking in anticipation.

Regards,
Yogesh
+Pie Number of slices to send: Send
See:
http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html

The File object has methods that return a list of files (as an array) from a directory.
+Pie Number of slices to send: Send
I tried in my servlet to read the names of files inside the folder images.
As:-

File file = new File("http://127.0.0.1:2020//pim//images");
System.out.println("file created....."+ file);
System.out.println("file created..file.getPath()"+file.getPath());
System.out.println("is the file directory??? "+file.isDirectory());
System.out.println("file.toURL??? "+file.toURL());

What i got as a output :

file created.....http:\127.0.0.1:2020\pim\images
file created..file.getPath()http:\127.0.0.1:2020\pim\images
is the file directory??? false
file.toURL??? file:/D:/tools/jboss-3.2.5/bin/http:/127.0.0.1:2020/pim/images


The folder/directory "images" does exist on the server.
server is installed locally on D:/tools/jboss-3.2.5.


Thanks
+Pie Number of slices to send: Send
The File(String) constructor is looking for a path to the file; not a URL.
http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html#File(java.lang.String)
And inside of my fortune cookie was this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1702 times.
Similar Threads
regarding peer to peer network through java
I/O stream to List class????? argh!!
Display All images from a folder on a html/jsp page
how to display list of war versions deployed under Jboss?
Can a servlet/jsp write/ read files outside its context/domain ?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 22:51:53.