| Author |
Error 92
|
sojan chandy
Greenhorn
Joined: Mar 18, 2007
Posts: 24
|
|
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
Joined: Feb 07, 2005
Posts: 2341
|
|
|
I think you missed a ". You have to escape each one if it's in a String.
|
 |
 |
|
|
subject: Error 92
|
|
|