File Upload Error
Hi,
I got below error while trying to upload a file to Servlet (get it from request object) from <input type=file> tag. The Weblogic/Oracle AS servers receive the files successfully when trying test the same in local PC. But uploading from another PC fails and gives below error,
Env: Weblogic 8.1 - Windows 2000.
please help:
Error 500--Internal Server Error
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.5.1 500 Internal Server Error
The server encountered an unexpected condition which prevented it from fulfilling the request.
Thanks,
Tom
Hi DrClap,
Thanks! But my problem is un-solved. May be I should explain more in detail on what I am doing.
I need to upload a file/xml file from client PC to App Server i.e. I am using JSP to display info to client and at server I am receiving the control with Servlet. I have used <input type=file > tag to upload files to request object. At Servlet end, I was trying to retrieve the object based on the name I had mentioned in <input type=file name=xmlfile> .
Is there a alternative for this or please tell me how to upload files from JSP/Client to Server(Servlet and read back there). Does JavaScript help us reading files and sending it as a object from client to server?
I have increased the Duke dollars.
Thanks,
Tom
1:
That means that your upload servlet is failing with some kind of exception. You should be able to find details of the exception in Weblogic's log files.
Hi DrClap,
Thanks! But my problem is un-solved.
Did you check the logs, if so what did they say?
2:
search file upload
http://forum.java.sun.com/thread.jsp?forum=33&thread=414276
http://forum.java.sun.com/thread.jsp?forum=33&thread=66616
http://forum.java.sun.com/thread.jsp?forum=33&thread=479194
3:
drclap say that there is a problem with your servlet, so to help solve your problem
you should have posted the servlet code, instead of describing your app operation.
it also seems that you ignored the steps to take(ie check logs).if you did check logs and
there was nothing relevent you should have said so
Hi,
Here is the exception... You can notice that, it fails in Servlet (doPost) where I am trying to download and read the file. The <input type=file> is not sending the entire file and it is only sending the file path. At the server end, it tries to read that file based on the path received from client. That is why it fails.
But I need to upload entire file from client PC through JSP to Servlet and read the uploaded file there.
Please help
java.io.FileNotFoundException: C:\TD.xml (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:64)
at dbcreate.DBServlet.doPost(DBServlet.java:28)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:945)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:332)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:242)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5363)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:721)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3043)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2466)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
>