Hi Johannes, take a look at the following bit of code. I use the FilePartArray rather than the FilePart. FilePartArray is a byte array holding the file contents in memory rather than a reference to a file already stored on disc, i.e. the file is not saved automatically and the data will be lost by the end of the request unless you've saved it (as I do below). I think, you also need to set the "autosave-uploads"-parameter in web.xml to false to make this work.
For more info see http://wiki.cocoondev.org/Wiki.jsp?page=FileUploadsWithCocoon If you need more info, let me know. Stefan Here's the code: Request request = ObjectModelHelper.getRequest(objectModel); FilePartArray filePartArray=(FilePartArray)request.get("uploaded_file"); OutputStream out = new BufferedOutputStream(new FileOutputStream(new File("/your/path/to/file.jpeg"))); // here put filename and where to save it InputStream in = filePartArray.getInputStream(); byte[] buf = new byte[8*1024]; int length; while ((length = in.read(buf)) != -1) out.write(buf,0,length) On Mon, 13 Oct 2003 08:05:14 +0000 Johannes Becker <[EMAIL PROTECTED]> wrote: > Hi, > > I looked at the "FileUploadWithAction" at Wiki > (http://wiki.cocoondev.org/Wiki.jsp?page=FileUploadWithAction). Since I'm > not a good programmer, could anyone tell me how to store the file > permanently on disc? > I found this thread: > http://archives.real-time.com/pipermail/cocoon-users/2003-September/038914.html > Is this what I need? > > Thanks > Jonny > > _________________________________________________________________ > Sch�tzen Sie Ihren Posteingang vor unerw�nschten E-Mails. > http://www.msn.de/antispam Jetzt Hotmail-Junk-Filter aktivieren! > > > --------------------------------------------------------------------- > 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]
