• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reading and manipulating file content on client machine

 
muktesh tripathi
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a desktop application that prompts a user for file names and then using regex manipulates and displays the sorted/selected data/lines..

I want to do the same thing in web app... Ask user for file name/names and then manipulate data using some POJO class and then display the result....

How can i achieve that if possible..
1.Is it possible to directly access file on client machine?
2.If not, than can I read only line by line from selected file and then direct that input for
manipulation to some other class(POJO) and then display result using JSP..
Please Help...

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34656
366
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Muktesh,
A web application can upload a single file if the user browses to it. Everything else is a security issue and forbidden by the browser.
 
Ankit Garg
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think that you can access files on the client machine. You will have to upload the file on the server and then manipulate the file. I don't think that applets can help either cause they run in the sandbox which will not allow you to access client files for security reason. So IMHO, file uploading is the solution...
 
muktesh tripathi
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks the answers confirmed my fear...

If I go for it ..is there a way to get a user select multiple files(3 or 4) from a particular directory on his machine???

Or as I fear I will have to ask him four times for four files in same directory......This will surely kill my intentions of making my programme web based....
Thanks in advance
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider an applet or webstart application.
 
Ankit Garg
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I don't think you can upload multiple files at once. At least not through file upload box. For that you will have to do some advance work. For example orkut allows you to upload multiple photos. That is a flash which let's you select multiple files. Similarly I think there must be more ways of doing this. But I don't know any of them so let's see if anyone has some idea about this...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ankit Garg wrote:Well I don't think you can upload multiple files at once.

Yes, you can. Multiple files can be uploaded in a single request. But each file must be individually selected via a file control input element.
 
Ankit Garg
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Yes, you can. Multiple files can be uploaded in a single request. But each file must be individually selected via a file control input element.


Yes I know that. But then he will have to ask the client to choose the files multiple times. That's what he doesn't want...
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ankit Garg wrote:
Yes I know that. But then he will have to ask the client to choose the files multiple times. That's what he doesn't want...


That's your only option if you want a pure HTML/Javascript front end.
 
muktesh tripathi
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all...
I have also seen those multiple file select option in geicites.com upload... but its a great pain...
Webstart is the only option I suppose...Never tried it....But this might be a good oppurtunity..
Thanks again
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
muktesh tripathi wrote:I have also seen those multiple file select option in geicites.com upload... but its a great pain...
Webstart is the only option I suppose...

More important than the pain you may feel is the pain your users may feel. I can't imagine a situation where selecting 4 files sequentially is more painful than the combined pain of your users having to live with a WebStart application, and you having to support it (and them). I regret to say this, but client-side Java in a browser is painful, for the most part.
 
muktesh tripathi
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I meant was that I require particular kinds of files to be manipulated...These files are generated as some kind of logs or from input stream from some port connected to .....they are generated 4 times a day in user specified folder..
now the user gives me path to those files and I give him output based on the files content after manipulation....
suppose the file is in c:\A\B\D\E\Folder... so to select the four files the user has to follow full path four times ....

 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you make sure that the file/directory structure is well-known in advance (and is not changing), so that you can code that knowledge into the application? That way, the user only has to select the root directory wherein all files/subdirectories are located.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
muktesh tripathi wrote:so to select the four files the user has to follow full path four times ....

In most browsers, the file upload dialog will remember the most recent folder.
 
muktesh tripathi
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"
In most browsers, the file upload dialog will remember the most recent folder."



I think this will be of great help....Is there any way of specifying the default path for file upload directory on the client side..refer quoted text below

"Could you make sure that the file/directory structure is well-known in advance (and is not changing), so that you can code that knowledge into the application? That way, the user only has to select the root directory wherein all files/subdirectories are located."

 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, that´s not possible with HTML.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic