harish kyasal
harish kyasal

Reputation: 3

java.io.FileNotFoundException when trying to add a file to JSP

When trying to add a file in my JSP code, I'm getting the following exception:

java.io.FileNotFoundException: /home/harish12/public_html/\uploads\16062015071419Darjeeling.jpg (Permission denied)

What am I doing wrong?

The complete error log is as follows:

HTTP Status 500 - java.io.FileNotFoundException: /home/harish12/public_html/\uploads\16062015071419Darjeeling.jpg (Permission denied)

type Exception report

message java.io.FileNotFoundException: /home/harish12/public_html/\uploads\16062015071419Darjeeling.jpg (Permission denied)

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: java.io.FileNotFoundException: /home/harish12/public_html/\uploads\16062015071419Darjeeling.jpg (Permission denied)
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:460)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
root cause

java.io.FileNotFoundException: /home/harish12/public_html/\uploads\16062015071419Darjeeling.jpg (Permission denied)
    java.io.FileOutputStream.open(Native Method)
    java.io.FileOutputStream.<init>(FileOutputStream.java:221)
    java.io.FileOutputStream.<init>(FileOutputStream.java:171)
    org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:417)
    org.apache.jsp.addattractions_jsp._jspService(addattractions_jsp.java:324)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.42 logs.

Upvotes: 0

Views: 817

Answers (1)

Alex
Alex

Reputation: 4473

It clearly tells you what is wrong:

/home/harish12/public_html**/\**uploads\16062015071419Darjeeling.jpg (Permission denied) 

These /\ are not part of the file path

Upvotes: 2

Related Questions