Hi Erez, Just wondering if you figured this out. I've found what I think could be a solution.
If you deploy your jboss ear in an exploded way: [ >How can a war file be deployed in a exploded way .. just create a directory named foo.ear and in the deploy directory, and unpack your EAR file in foo.ear. Then unpack the WAR file in a directory named foo.war in foo.ear. ] then you can write the uploaded files to a folder that the tomcat server will be able to serve! This works for me. Email me for more details. Brian -----Original Message----- From: Erez Efrati [mailto:[EMAIL PROTECTED] Sent: 18 August 2003 15:53 To: 'Struts Users Mailing List' Subject: RE: file upload problem I am dealing as well with the file upload issue: 1) To where should I save those files. For one I haven't done this, so this is all new. Also, I am using JBoss and I saw that no matter which directory I choose under my application context directory, this directory will be deleted and recreated upon redeployment so I guess there is a convention that I am not aware of. If I go and save my files in a "c:\files" how could links from JSP access those files. Lost in the wilderness :) How is it done? 2) I could always store those files in the database but then I would have to access them through an action, is this wise? Thanks a bunch, Erez -----Original Message----- From: Brian McSweeney [mailto:[EMAIL PROTECTED] Sent: Monday, August 18, 2003 3:46 PM To: 'Struts Users Mailing List' Subject: RE: file upload problem Shane, You are a star! That fixed it! Thanks very much, Brian -----Original Message----- From: Witbeck, Shane [mailto:[EMAIL PROTECTED] Sent: 18 August 2003 14:17 To: [EMAIL PROTECTED] Subject: RE: file upload problem I had a similar problem until I realized that you must specify a file and not a folder for the upload path (i.e. /tmp/upload/upload.txt not /tmp/upload). HTH, Shane -----Original Message----- From: Brian McSweeney [mailto:[EMAIL PROTECTED] Sent: Monday, August 18, 2003 7:24 AM To: 'Struts Users Mailing List' Subject: RE: file upload problem Thanks Prashanth, But I don't think that's the problem. Thanks anyway though, Brian -----Original Message----- From: Prashanth.S [mailto:[EMAIL PROTECTED] Sent: 18 August 2003 11:44 To: Struts Users Mailing List Subject: Re: file upload problem hi brian, try changing the folder permission from read-only??Its just a guess Thanks Prashanth Brian McSweeney <[EMAIL PROTECTED]> wrote: Hi all, I'm trying to do a file upload action based on the example struts-upload.war. I want to save the uploaded file to a folder on disk. However when I try to run the action I get an error saying I don't have access to the folder. I've tried changing the folder access and also using a different folder. I still get a file not found exception which says java.io.FileNotFoundException: .. (Access is denied) I'm using JBoss 3.2.1_tomcat4.1.24. Perhaps JBoss restricts folder access? The code that runs the struts action is:- AddProductForm frm = (AddProductForm) form; //retrieve the file representation FormFile file = frm.getTheFile(); //retrieve the file name String fileName= file.getFileName(); //retrieve the content type String contentType = file.getContentType(); //retrieve the file size String size = (file.getFileSize() + " bytes"); log.info("File details - name: "+fileName); log.info("File details - contentType: "+contentType); log.info("File details - size: "+size); // this is where I get the folder path to save the image into. String imageStorePath = Init.getImageStorePath(); log.info("the value of imageStorePath is: "+imageStorePath); try { //retrieve the file data ByteArrayOutputStream baos = new ByteArrayOutputStream(); InputStream stream = file.getInputStream(); //write the file to the file specified OutputStream bos = new FileOutputStream(imageStorePath); int bytesRead = 0; byte[] buffer = new byte[8192]; while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) { bos.write(buffer, 0, bytesRead); } bos.close(); log.info("The file has been written to \"" + imageStorePath + "\""); //close the stream stream.close(); } catch (FileNotFoundException fnfe) { log.error("Couldn't find the file: "+ fnfe.toString()); } catch (IOException ioe) { log.error("io exception: "+ ioe.toString()); } finally{ //destroy the temporary file created file.destroy(); return mapping.findForward( WebConstants.SUCCESS ); } } Any help would be greatly appreciated. Cheers, Brian --------------------------------- Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software --------------------------------------------------------------------- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]