I've tried to get the upload to work, but im constantly met with the access denied error.
I've setup the .java.policy file in my home dir - but I'm in doubt over what I should choose as codebase? Is it http:// or is it file:/ ? /Martin -----Original Message----- From: Tony Oslund [mailto:[EMAIL PROTECTED] Sent: 15. november 2004 23:32 To: Turbine Users List Subject: Re: How to upload Images You are correct, but there can be an additional twist. The uploaded file may be in memory, or it may have been cached to disk. The following basic test takes care of this. File file = fileItem.getStoreLocation(); if (file == null) { // The file is in memory and can be obtained this way: InputStream is = fileItem.getStream(); im.insertImage(image, is); } else { // The file has been written to temporary storage and can be moved to database: im.insertImageFromFile(image, file.getAbsolutePath()); } Also the size of file that you can upload is affected by your turbine props settings. If the setting is too small the upload will fail. # Whether the files should be automatically picked up by # ParameterParser. services.UploadService.automatic=true # # The directory where files will be temporarily stored. # services.UploadService.repository=. # # The maximum size of a request that will be processed. # services.UploadService.size.max=104857600 # # The maximum size of a request that will have it's elements cached in # memory by TurbineUploadService class. # services.UploadService.size.threshold=10 ----- Original Message ----- From: "David Demner" <[EMAIL PROTECTED]> To: "'Turbine Users List'" <[EMAIL PROTECTED]>; "'Albrecht Leiprecht'" <[EMAIL PROTECTED]> Sent: Monday, November 15, 2004 3:26 PM Subject: RE: How to upload Images > The critical part is to set enctype to multipart/form-data in the HTML > form: > > <form method="post" enctype="multipart/form-data" > action="$link.setPage("UploadImage.vm").setAction("UploadImage")"> > > The rest should work as you have below. > > David > > > -----Original Message----- > From: Albrecht Leiprecht [mailto:[EMAIL PROTECTED] > Sent: Monday November 15, 2004 12:17 PM > To: Turbine Users List > Subject: How to upload Images > > > Hi all, > > I understand that > > FileItem fileItem = data.getParameters().getFileItem("file"); > fileItem.write(TurbineServlet.getRealPath("") +"/images/" + > data.getUser().getUserName() + ".jpg"); > > is supposed to be used for uploading content through forms in Turbine > actions. > It seems to work, with one little problem.... The image I am getting on > the > server is > totally scrambled. Doesnt look like the original at all. > > The above example works fine with textfiles __ignore the *jpg ;) __ > I assume that i woul have to fiddle with the content type somewhere. But > the > question is where and how... > > Does anyone have an idea ?? > > kind regards > Albrecht F. Leiprecht > > > PS: > I am using Turbine 2.1 on Tomcat 4 > > > --------------------------------------------------------------------- > 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]
