my html page

<form action="file_insert.jsp" method="get" name="ff" onsubmit="return validation()" >
              <tr> 
                <td height="50" colspan="2" align="center"><font color="#CC0033"><strong><font color="#663366"><em><font size="4">Fileupload 
                  </font> </em> </font></strong></font></td>
              </tr>
              <tr> 
                <td width="117" height="36"><font color="#FFFFFF"><em><font color="#663333"><strong><font color="#400040">Filename:</font></strong></font></em></font></td>
                <td width="219"><input type="text" name="fn" class="a" /></td>
              </tr>
              <tr> 
                <td height="43"><em><font color="#663333"><strong><font color="#400040">File 
                  id:</font></strong></font></em></td>
                <td width="219"> <input type="text"  class="a"  name="fid"  value=" 381" /></td>
              </tr>
              <tr> 
                <td height="46"><em><font color="#663333"><strong><font color="#400040">Choose 
                  file</font></strong></font></em></td>
                <td width="219"><input type="file" name="file1" class="a" /></td>
              </tr>
              <tr> 
                <td height="45" colspan="2" align="center"><input type="submit" name="submit1" class="button" value="upload"  /></td>
              </tr>
            </form>

file_insert.jsp

<%@ page import = "java.util.Date,java.text.SimpleDateFormat,java.text.ParseException,java.util.Calendar"%>

<%@ page import="java.sql.*,java.io.*"  %>
<%@ page import="java.util.date.*,java.util.text.DateFormat.*,java.text.ParseException.*"%>
<%@page 

import="com.oreilly.servlet.*,java.sql.*,java.lang.*,databaseconnection.*,java.text.SimpleDateFormat,java.util.

*" %>
<%@ page import = "java.util.Date,java.text.SimpleDateFormat,java.text.ParseException"%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
     <%
          java.util.Date now = new java.util.Date();
     String DATE_FORMAT1 = "yyyy-MM-dd";
     SimpleDateFormat sdf1 = new SimpleDateFormat(DATE_FORMAT1);
     String un=(String)session.getAttribute("un");

     String ds = sdf1.format(now);
      String fn=request.getParameter("fn");
       String fid=request.getParameter("fid");
        String file1=request.getParameter("file1");
       String f="E:\\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\shak\file\\";
String f1=f+file1;
File ff= new File(f1);
         double size=ff.length();
          double  size1=size/1024;
          double size2=Math.round(size1*100.0)/100.0;
          String size3=Double.toString(size2);
          session.setAttribute("filesize",size3);


String u="0";
String a="0";
           FileInputStream fis;
            try
{

Class.forName("com.mysql.jdbc.Driver"); 
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/foxcomputing","root","admin");
PreparedStatement ps=con.prepareStatement("insert into fileupload(uname,fname,fid,file,size,date,au,uau) values 

(?,?,?,?,?,?,?,?)");
fis=new FileInputStream(ff);
ps.setString(1,un);
ps.setString(2,fn);
ps.setString(3,fid);

ps.setBinaryStream(4, (InputStream)fis, (int)(ff.length()));
ps.setString(5,size3);
ps.setString(6,ds);
ps.setString(7,u);
ps.setString(8,a);
ps.executeUpdate();
response.sendRedirect("user_upload.jsp");
}
catch(Exception e)
{
out.println(e.getMessage());
}

%>




</body>
</html>

when i click submit iam getting the following error

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 24 in the jsp file: /file_insert.jsp
Invalid escape sequence (valid ones are  \b  \t  \n  \f  \r  \"  \'  \\ )
21:       String fn=request.getParameter("fn");
22:        String fid=request.getParameter("fid");
23:         String file1=request.getParameter("file1");
24:        String f="E:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\fog computing\file\\";
25: String f1=f+file1;
26: File ff= new File(f1);
27:          double size=ff.length();


Stacktrace:
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:356)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:321)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
Member Avatar
LastMitch

Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \ )\)

I think the forward-slash or a backslash is interfering with the string sequence. Try removing it by using this:

http://www.regular-expressions.info/charclass.html

Then the error will disappear.

also, that is very messy code... learn to use servlets and separate your logic from your UI. as soon as you plan to maintain this code, you'll thank yourself for doing so.

am using the tomcat server and the path for uploading files is working when we brower the files from the tomcat server directory example ( folder names as file xx.txt abc.doc ) and am able to upload the files but when downloading those files am unable to read the files they are not in readable format ?