0

I am trying to develop a J2EE web application which reads files from the local machine. The user will be able to enter a path where the file exists and when a button is clicked, the file is read and a database should be uploaded. This feature works fine when I tested it locally, but when I moved the code to the web server, it is not able to find the file. This is because the application is trying to find the file at the server and not the local machine. Could some one please let me know if there is any way I could read the file from the local machine?

I ve been using struts/tomcat for developing this application

Thanks

8
  • You want the web application to transparently access files on your own personal machine? Why not deploy it to the server? Commented Oct 18, 2011 at 20:00
  • Did you upload the file on the server ? Commented Oct 18, 2011 at 20:00
  • are you using XMLHttpRequest ? Commented Oct 18, 2011 at 20:02
  • Thanks for your response. I will try uploading the file to the server, but just wanted to know if there was any way to access the file remotely. Commented Oct 18, 2011 at 20:11
  • @ bilash.saha - yes. i am using XMLHttpRequest Commented Oct 18, 2011 at 20:11

3 Answers 3

1

An option: Check out this Rose India article

Another option: do a google search for "file upload jsp"

Sign up to request clarification or add additional context in comments.

2 Comments

thanks for your help. i am planning to move the file to the server and then access it.
i am very new to developing web applications. could some one please tell me where in the server should i place the file?
0

try

<input type="file"/>

It is impossible to read a file on a remote computer without sending it to the server... obviously!

2 Comments

thanks for your help. i am very new to developing web applications. could you please tell me where in the server should i place the file?
For sure, it would be best to use an upload procedure as indicate @DwB. If not, you should share some directory on the server to allow users to drop here the files or something similar. The path is irrelevant as far as the webserver user have access to it.
0

Local file access is usually permitted if you run the browser App from the local file system, and not thru an Web server.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.