Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error 92

 
sojan chandy
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i was tring to upload a file, i don kno why its not working. can any body help me in finding what actually the mistake is?

FileUpld.java 14: illegal character:\92
out.println("file upload success" <a href=\"/jspbook/files/");




package com.jspbook;
import java.util.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.commons.fileuploads.*;

public class FileUpld extends HttpServlet {
public void doPost(HttpServletRequest req,HttpServletResponse res)
throws IOException,ServletException{
res.setContentType("text/plain");
PrintWriter out=res.getWriter();
out.println("<html>");
out.println("file upload success" <a href=\"/jspbook/files/");
out.println("\">Click here to browse");
out.println(files</a><br>");
ServletContext sc= getServletContext();
String path=sc.getRealPath("/files");
org.apache.commons.fileuploads fu = new org.apache.commons.fileuploads.FileUpload();


fu.setSizeMax(-1);
fu.setRepositoryPath("/test/todelete");
try
{
List l=fu.parseRequest(req)
Iterator i=l.iterator();
}
while(i.hasNext())
{
FileItem fi=(FileItem)i.next();
fi.write(path+"/"fi.getName());
}
}
catch (Exception e)
{
throw new ServletException(e);
}
out.println("</html>");
}


public void doGet(HttpServletRequest req,HttpServletResponse res)
throws IOException,ServletException
{
doPost(req,res);
}
}

tnx in advance
[ March 25, 2007: Message edited by: sojan chandy ]
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you missed a ". You have to escape each one if it's in a String.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic