This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi i have written a jsp which browse for a file and read its contents .. when i browse the file the IE is passing complete file path to the servlet C:\example\book1.xls where as when i try to run the same program on Firefox it says file cannot be found.. seeing this is thought i will restrict my application to be used on IE, but now when i run my app(server running on my machine) from other machine it tries to search the file on my machine and give errors
C:\Documents and Settings\rsrinivasan\Desktop\plots.xls (The system cannot find the path specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(Unknown Source) at java.io.FileInputStream.<init>(Unknown Source) at excelread.FAFilePopulate.doGet(FAFilePopulate.java:38) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Unknown Source)
where onchange send the file name to the servlet ReadFile.java
please suggest me something how do i get the file path where instance of the application is running on some other system other then mine
[ November 06, 2008: Message edited by: Paul Sturrock ] [ November 09, 2008: Message edited by: ruquia tabassum ]
as tomcat is running on my system c:\Documents and Setting\rsrinivasan\plots.xls doesnot exists on my system, plots.xls file exists on the system name rsrinivasan.... as instance of my application is running on rsrinivasan system from there when a file is uploaded it gives me the error "system cannot find the path specified"
Tomcat does not automatically get the file and does not automatically save it on the server if you add a file upload input element on your HTML form. You need something to handle the file upload. Use a library, such as Apache Commons FileUpload for example, to get the file from the client computer and save it on the server.
Instead of saving the file from client computer on the server machine cant there be any other possible solution? because i cannot store the file on the server machine it increases the overhead on server, the application is accessed by suppose 100 employees and every one uploads a file every 10 minutes and each file is more than 500KB per day around 50000 files get stored on the serve machine ... which makes the server less efficient,slow.
if i run a batch such that the temporary files stored are to be deleted every morning still there will be some point of time in a busy day where the server gets loaded with large data and becomes slow. Also as the server maintains all the live database i cannot store and delete files from it very frequently...
Please suggest me something how do i solve this issue...