change the below line of ur action file String fileName2 = filePath+"/"+fileName; to String fileName2 = filePath+fileName;
----- Original Message ----- From: "uma.k" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>; "'Jay Chandran'" <[EMAIL PROTECTED]> Sent: Saturday, December 18, 2004 3:44 PM Subject: RE: file upload problem > I get an error > "org.apache.jasper.compiler.CompileException: /upload/upload.jsp(32,4) > Attribute enctype invalid according to the specified TLD" > > I am already using enctype in the <html:form> But when I hard code the > value to system path e.g. c:\\test\\mages then it works but I dont want > this. As I need to upload the file to the server. > > Any ideas? > > -----Original Message----- > From: Jay Chandran [mailto:[EMAIL PROTECTED] > Sent: Saturday, December 18, 2004 3:57 PM > To: Struts Users Mailing List > Subject: Re: file upload problem > > > include the below and check > > <html:text property="filePath" value="/upload/images" > enctype="multipart/form-data"/> > > > ----- Original Message ----- > From: "uma.k" <[EMAIL PROTECTED]> > To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> > Sent: Saturday, December 18, 2004 3:10 PM > Subject: file upload problem > > > > Hi, > > I am modifying the upload files given by struts and trying to upload the > > file to server without the user entering any path. > > > > I have modified the upload.jsp with > > <html:text property="filePath" value="/upload/images" /> > > > > Its means I am trying to upload to the same context in which the jsp is > > running (webapps/test/upload/images) > > > > I have modified the UploadAction.java as > > > > //else { > > //write the file to the file specified > > String filePath = theForm.getFilePath(); > > System.out.println("filePath:"+filePath); > > String fileName2 = filePath+"/"+fileName; > > System.out.println("fileName2:"+fileName2); > > OutputStream bos = new FileOutputStream(fileName2); > > int bytesRead = 0; > > byte[] buffer = new byte[8192]; > > while ((bytesRead = stream.read(buffer, 0, 8192)) > != -1) > > { > > bos.write(buffer, 0, bytesRead); > > } > > bos.close(); > > data = "The file has been written to \"" + > > theForm.getFilePath() + "\""; > > //} > > > > I get this output too > > filePath:/upload/images > > fileName2:/upload/images/test.jpg > > > > I do not have any error the page just becomes blank and the file is not > > uploaded. Any ideas? > > > > Uma > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]