Help coderanch get a
new server
by contributing to the fundraiser
    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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

How to read a file from client machine

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi,

Can anyone help to know how to read an excel file from client's machine.

Thanks,
Ruchika
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
The user would need to upload the file to the server first. The Apache Commons FileUpload library can handle that on the server. Then your code can read the file by using a library such as Apache POI or jExcelApi.
 
Ruchika Kapoor
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi,
My requirement is :

I've an html page with browse button on it. User will select the file from its local disk which needs to be uploaded to the ftp server. Now i am not able to read the file due to java security constraints. What are the ways to read the file from client machine.

Thanks,
Ruchika
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Since you posted to the JSP forum I'm assuming that your code runs as part of a web app; is that correct? If so, it can't access files on the client system. As I said above, they need to be uploaded to the server first.

I'm not clear how the FTP server fits in. An HTML page can't upload to an FTP server, only to a web server.
[ July 16, 2008: Message edited by: Ulf Dittmer ]
 
Ruchika Kapoor
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Thanks Ulf Dittmer!

Your suggestion worked.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Ruchika Kapoor wrote:Thanks Ulf Dittmer!

Your suggestion worked.



Hi ruchika,

Can you post your code here? i am also facing the same problem.

 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please do not resurrect old topics. This makes no sense. Asking for code makes also no sense. You're the developer here.

The answer to your problem is already given: use Apache Commons FileUpload.

Just start at their homepage http://commons.apache.org/fileupload and explore at least 'User Guide' and 'Frequently Asked Questions' links. It is certainly more than enough information how to develop a JSP page with file upload.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic