Re: File upload location
Deepak wrote: Hi, What is the default location of a file uploaded using html:file ? Can I upload it to one of the folders in my context path ? It goes someplace temporary. If you look at the src for the UploadAction example in Struts, it shows how to save the temporary file. I create a temporary dir with sessionCreated() in the HttpSessionListener ie myapp/temp/sessionID then you can get to it via session.getServletContext().getRealPath(temp) + /+ session.getId(); and create an outputstream that goes there. When the session is destroyed I remove the files and the dir myapp/temp/sessionID thanks Deepak -- Mark Shifman MD. Ph.D. Yale Center for Medical Informatics Phone (203)737-5219 [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File-Upload: Progress-Bar
A simpler solution that may still meet your needs might be to use an animated GIF on a pop-up just to give the user some feedback that the upload is still in progress and that they should be patient. You could setup something like this: The HTML form with upload file input element has a hidden field with some UUID generated by the Action. The UUID is just some unique ID to avoid having two upload forms with the same ID. For instance, the session-id or perhaps session-id+current_time would work fine for a UUID. Have the javascript onSubmit for the form pop-up a window, where the content of that window will be /uploadStatus.do?UUID=234344. Your /uploadStatus.do action will look for the UUID and forward to a JSP with the animated GIF in it if that file has not completed uploading. That JSP will have a meta-refresh in it that will refresh the content of the pop-up every few seconds. The form submit with the file upload input element will be uploading the file for a while. When it finishes, it will indicate that the file upload with UUID=234344 has completed to some server-side upload-tracking subsystem. Then it will forward or redirect to whatever page the user should see when the upload completes. The pop-up status window will refresh itself within a second or two, and the /uploadStatus.do action will determine that the upload for the file with UUID=234344 has completed (by checking with the server-side upload-tracking subsystem). It will then forward to a JSP that closes the pop-up window or shows a message that the upload has completed. This isn't a progress bar, but it should be easier to implement. You could even use a fast-cycling animated GIF that looks like a progress bar (but doesn't really relate to the actual % progress) if that would satisfy your UI design requirements. -Max - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, March 19, 2004 1:31 AM Subject: File-Upload: Progress-Bar Hello everybody! I'm up to the task to implement a progress bar for File-Uploads, cause the files that are uploaded to my Webapp can be quite large. Well as usual this problem is not easily solved on the HTTP-Browser upload side. I'm using Struts here so I'm also using the commons/FileUpload. I was planning to do it that way that I assign a unique number to every session's-upload and keep the current status of an upload in a singleton for access. In an additional frame (with refresh) I would like to show the progress bar. My question: Has anybody done something like this with Struts before and can give me some little advise? Or more specific: Is it possible to first get the complete filesize from the FormFiles and the do the real Upload during the Action (keeping track of the read bytes) Thx for every help!! ___ Tim Adler, Abt. SDA1 Adress Management Solutions AZ | Direct Carl-Bertelsmann Straße 161s D-33311 Gütersloh Tel.: 05241/ 80 - 89574 [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File-Upload: Progress-Bar
At 10:31 AM +0100 3/19/04, [EMAIL PROTECTED] wrote: I'm up to the task to implement a progress bar for File-Uploads ... My question: Has anybody done something like this with Struts before and can give me some little advise? I think someone is working on this, or at least has posted a bugzilla enhancement to commons-fileupload requesting it. You might want to search the commons-dev mailing list archives or do a bugzilla search. Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Imagine if every Thursday your shoes exploded if you tied them the usual way. This happens to us all the time with computers, and nobody thinks of complaining. -- Jef Raskin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: File-Upload: Progress-Bar
I could tell you how I'm going it (I also have very large files to upload.) 1) Once the upload request comes in, I launch a thread from my action class/servlet to handle the actual upload 2) I then forward to a page which displays a message indicating status. 3) I use java script to submit the status page so I can check on the progress of the upload and prevent browser timeout. I set this submit for every 10 secs. 4) Once I determine that the upload has completed, I forward back to my upload jsp page (or wherever you need to go next.) As for the size of the file ... that depends on whether or not the multipart message contains the filesize. --JoAnn -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, March 19, 2004 2:31 AM To: [EMAIL PROTECTED] Subject: File-Upload: Progress-Bar Hello everybody! I'm up to the task to implement a progress bar for File-Uploads, cause the files that are uploaded to my Webapp can be quite large. Well as usual this problem is not easily solved on the HTTP-Browser upload side. I'm using Struts here so I'm also using the commons/FileUpload. I was planning to do it that way that I assign a unique number to every session's-upload and keep the current status of an upload in a singleton for access. In an additional frame (with refresh) I would like to show the progress bar. My question: Has anybody done something like this with Struts before and can give me some little advise? Or more specific: Is it possible to first get the complete filesize from the FormFiles and the do the real Upload during the Action (keeping track of the read bytes) Thx for every help!! ___ Tim Adler, Abt. SDA1 Adress Management Solutions AZ | Direct Carl-Bertelsmann Straße 161s D-33311 Gütersloh Tel.: 05241/ 80 - 89574 [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File-Upload: Progress-Bar
Check the archives. There has been a lot on this. At 01:31 AM 3/19/2004, you wrote: Hello everybody! I'm up to the task to implement a progress bar for File-Uploads, cause the files that are uploaded to my Webapp can be quite large. Well as usual this problem is not easily solved on the HTTP-Browser upload side. I'm using Struts here so I'm also using the commons/FileUpload. I was planning to do it that way that I assign a unique number to every session's-upload and keep the current status of an upload in a singleton for access. In an additional frame (with refresh) I would like to show the progress bar. My question: Has anybody done something like this with Struts before and can give me some little advise? Or more specific: Is it possible to first get the complete filesize from the FormFiles and the do the real Upload during the Action (keeping track of the read bytes) Thx for every help!! ___ Tim Adler, Abt. SDA1 Adress Management Solutions AZ | Direct Carl-Bertelsmann Straße 161s D-33311 Gütersloh Tel.: 05241/ 80 - 89574 [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: File-Upload: Progress-Bar
Hi Tim! i didn't tryed it out, but on ORA's ONJAVA is saw an artikel on that http://www.onjava.com/lpt/a/3886 perhaps you got some ideas on it! Cheers, Matthias -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, March 19, 2004 10:31 AM To: [EMAIL PROTECTED] Subject: File-Upload: Progress-Bar Hello everybody! I'm up to the task to implement a progress bar for File-Uploads, cause the files that are uploaded to my Webapp can be quite large. Well as usual this problem is not easily solved on the HTTP-Browser upload side. I'm using Struts here so I'm also using the commons/FileUpload. I was planning to do it that way that I assign a unique number to every session's-upload and keep the current status of an upload in a singleton for access. In an additional frame (with refresh) I would like to show the progress bar. My question: Has anybody done something like this with Struts before and can give me some little advise? Or more specific: Is it possible to first get the complete filesize from the FormFiles and the do the real Upload during the Action (keeping track of the read bytes) Thx for every help!! ___ Tim Adler, Abt. SDA1 Adress Management Solutions AZ | Direct Carl-Bertelsmann Straße 161s D-33311 Gütersloh Tel.: 05241/ 80 - 89574 [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File-Upload: Progress-Bar
Joe Germuska [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] At 10:31 AM +0100 3/19/04, [EMAIL PROTECTED] wrote: I'm up to the task to implement a progress bar for File-Uploads ... My question: Has anybody done something like this with Struts before and can give me some little advise? I think someone is working on this, or at least has posted a bugzilla enhancement to commons-fileupload requesting it. You might want to search the commons-dev mailing list archives or do a bugzilla search. Yes, there is an enhancement request open against Commons FileUpload for this, complete with code: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25830 Expect something along these lines in a forthcoming release of FileUpload, with subsequent support in Struts. -- Martin Cooper Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Imagine if every Thursday your shoes exploded if you tied them the usual way. This happens to us all the time with computers, and nobody thinks of complaining. -- Jef Raskin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: File-Upload: Progress-Bar : Mega Upload
So I have never tried this.. But if someone can try it and let me know.. Check this out http://www.raditha.com/megaupload/jsp.php Its progress bar thing that uses struts :) Today when I was driving to work.. I thought if a progress bar can be done using an applet.. :) ideas. ideas.. ideas.. Pritpal Dhaliwal -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED] Sent: Friday, March 19, 2004 10:39 AM To: [EMAIL PROTECTED] Subject: Re: File-Upload: Progress-Bar Joe Germuska [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] At 10:31 AM +0100 3/19/04, [EMAIL PROTECTED] wrote: I'm up to the task to implement a progress bar for File-Uploads ... My question: Has anybody done something like this with Struts before and can give me some little advise? I think someone is working on this, or at least has posted a bugzilla enhancement to commons-fileupload requesting it. You might want to search the commons-dev mailing list archives or do a bugzilla search. Yes, there is an enhancement request open against Commons FileUpload for this, complete with code: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25830 Expect something along these lines in a forthcoming release of FileUpload, with subsequent support in Struts. -- Martin Cooper Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Imagine if every Thursday your shoes exploded if you tied them the usual way. This happens to us all the time with computers, and nobody thinks of complaining. -- Jef Raskin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File Upload and DynaActionForm?
I don't believe that DynaActionForm supports the org.apache.struts.upload.FormFile type. See: http://jakarta.apache.org/struts/userGuide/building_controller.html#dyna_action_form_classes -Rob Carl-Eric Menzel wrote: Hello, I'm having trouble getting file upload working when using a DynaAction form. Here are the relevant parts: form-bean name=pollForm type=org.apache.struts.action.DynaActionForm form-property name=active type=java.lang.Boolean/ form-property name=name type=java.lang.String/ form-property name=version type=java.lang.Integer/ form-property name=pollid type=java.lang.Long/ form-property name=owner type=java.lang.String/ form-property name=ownerId type=java.lang.Long/ form-property name=editorsToRemove type=java.lang.Long[]/ form-property name=newEditorId type=java.lang.Long/ form-property name=addressText type=java.lang.String/ form-property name=introText type=java.lang.String/ form-property name=endText type=java.lang.String/ form-property name=fieldAddress1 type=java.lang.Integer/ form-property name=fieldAddress2 type=java.lang.Integer/ form-property name=fieldCell type=java.lang.Integer/ form-property name=fieldCity type=java.lang.Integer/ form-property name=fieldCountry type=java.lang.Integer/ form-property name=fieldEmail type=java.lang.Integer/ form-property name=fieldFirst type=java.lang.Integer/ form-property name=fieldLast type=java.lang.Integer/ form-property name=fieldPhone type=java.lang.Integer/ form-property name=fieldState type=java.lang.Integer/ form-property name=fieldZip type=java.lang.Integer/ form-property name=destinationPgId type=java.lang.Long/ form-property name=command type=java.lang.String/ form-property name=commandParam type=java.lang.String/ form-property name=locale type=java.lang.String/ form-property name=theme type=java.lang.String/ form-property name=futureContactText type=java.lang.String/ form-property name=ticketRequired type=java.lang.Boolean/ form-property name=tickets type=org.apache.struts.upload.FormFile/ /form-bean ...and in the tile: html-el:file property=tickets/ It worked before, only without the file upload stuff - that is a new addition. Now that I added this FormFile property, I get the following from the tile: [ServletException in:/pages/editor/editPoll.jsp] No getter method for property tickets of bean org.apache.struts.taglib.html.BEAN' Any ideas on what I might be doing wrong? Thanks Carl-Eric - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File Upload and DynaActionForm?
Did you change the form definition to enctype=multipart/form-data yet? --- Carl-Eric Menzel [EMAIL PROTECTED] wrote: Hello, I'm having trouble getting file upload working when using a DynaAction form. Here are the relevant parts: form-bean name=pollForm type=org.apache.struts.action.DynaActionForm form-property name=active type=java.lang.Boolean/ form-property name=name type=java.lang.String/ form-property name=version type=java.lang.Integer/ form-property name=pollid type=java.lang.Long/ form-property name=owner type=java.lang.String/ form-property name=ownerId type=java.lang.Long/ form-property name=editorsToRemove type=java.lang.Long[]/ form-property name=newEditorId type=java.lang.Long/ form-property name=addressText type=java.lang.String/ form-property name=introText type=java.lang.String/ form-property name=endText type=java.lang.String/ form-property name=fieldAddress1 type=java.lang.Integer/ form-property name=fieldAddress2 type=java.lang.Integer/ form-property name=fieldCell type=java.lang.Integer/ form-property name=fieldCity type=java.lang.Integer/ form-property name=fieldCountry type=java.lang.Integer/ form-property name=fieldEmail type=java.lang.Integer/ form-property name=fieldFirst type=java.lang.Integer/ form-property name=fieldLast type=java.lang.Integer/ form-property name=fieldPhone type=java.lang.Integer/ form-property name=fieldState type=java.lang.Integer/ form-property name=fieldZip type=java.lang.Integer/ form-property name=destinationPgId type=java.lang.Long/ form-property name=command type=java.lang.String/ form-property name=commandParam type=java.lang.String/ form-property name=locale type=java.lang.String/ form-property name=theme type=java.lang.String/ form-property name=futureContactText type=java.lang.String/ form-property name=ticketRequired type=java.lang.Boolean/ form-property name=tickets type=org.apache.struts.upload.FormFile/ /form-bean ...and in the tile: html-el:file property=tickets/ It worked before, only without the file upload stuff - that is a new addition. Now that I added this FormFile property, I get the following from the tile: [ServletException in:/pages/editor/editPoll.jsp] No getter method for property tickets of bean org.apache.struts.taglib.html.BEAN' Any ideas on what I might be doing wrong? Thanks Carl-Eric -- Carl-Eric Menzel * OpenPGP KeyID 808F4A8E * Encrypted Messages Preferred | Of course, on the system *I* administrate, vi is symlinked to | | ed. Emacs has been replaced by a shell script which 1) Generates a | | syslogmessage at level LOG_EMERG; 2) reduces the user's disk quota | | by 100K; and 3) RUNS ED! - Patrick J. LoPresti | - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File Upload and DynaActionForm?
Hello Carl-Eric, What browser you used for testing? Opera have bug when upload field in form is null. Wednesday, February 18, 2004, 5:45:24 AM, you wrote: CEM Hello, CEM I'm having trouble getting file upload working when using a DynaAction CEM form. Here are the relevant parts: CEM form-bean CEM name=pollForm CEM type=org.apache.struts.action.DynaActionForm CEM CEM form-property name=active type=java.lang.Boolean/ CEM form-property name=name type=java.lang.String/ CEM form-property name=version type=java.lang.Integer/ CEM form-property name=pollid type=java.lang.Long/ CEM form-property name=owner type=java.lang.String/ CEM form-property name=ownerId type=java.lang.Long/ CEM form-property name=editorsToRemove type=java.lang.Long[]/ CEM form-property name=newEditorId type=java.lang.Long/ CEM form-property name=addressText type=java.lang.String/ CEM form-property name=introText type=java.lang.String/ CEM form-property name=endText type=java.lang.String/ CEM form-property name=fieldAddress1 type=java.lang.Integer/ CEM form-property name=fieldAddress2 type=java.lang.Integer/ CEM form-property name=fieldCell type=java.lang.Integer/ CEM form-property name=fieldCity type=java.lang.Integer/ CEM form-property name=fieldCountry type=java.lang.Integer/ CEM form-property name=fieldEmail type=java.lang.Integer/ CEM form-property name=fieldFirst type=java.lang.Integer/ CEM form-property name=fieldLast type=java.lang.Integer/ CEM form-property name=fieldPhone type=java.lang.Integer/ CEM form-property name=fieldState type=java.lang.Integer/ CEM form-property name=fieldZip type=java.lang.Integer/ CEM form-property name=destinationPgId type=java.lang.Long/ CEM form-property name=command type=java.lang.String/ CEM form-property name=commandParam type=java.lang.String/ CEM form-property name=locale type=java.lang.String/ CEM form-property name=theme type=java.lang.String/ CEM form-property name=futureContactText type=java.lang.String/ CEM form-property name=ticketRequired type=java.lang.Boolean/ CEM form-property name=tickets CEM type=org.apache.struts.upload.FormFile/ CEM /form-bean CEM ...and in the tile: html-el:file property=tickets/ CEM It worked before, only without the file upload stuff - that is a new CEM addition. Now that I added this FormFile property, I get the following CEM from the tile: CEM [ServletException in:/pages/editor/editPoll.jsp] No getter CEM method for property tickets of bean CEM org.apache.struts.taglib.html.BEAN' CEM Any ideas on what I might be doing wrong? CEM Thanks CEM Carl-Eric -- Best regards, A3Tmailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: File Upload using Struts
The struts1.1 distribution contains a file jakarta-struts-1.1\webapps\struts-upload.war. This will answer all your queries. Manjunath/ -Original Message- From: Gandhi, Snehal Kishore (Cognizant) [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 03, 2004 5:21 PM To: [EMAIL PROTECTED] Subject: File Upload using Struts Hi all, i'm a new bee of struts... i want to use the Struts based upload option. 1. What should be the data type in my ActionForm? 2. How will i get the FileObject in my action class? and How can i pass the file to the Server? 4. if any sample upload code using struts would be really very helpful? thanx in advance.. --Snehal -- Snehal K. Gandhi | Email : [EMAIL PROTECTED] Financial Services Group | http://www.cognizant.com http://www.cognizant.com/ Cognizant Corporation| Ph:91-44-52096000 Mobile : +91 98400 57326 | Xtn:8118, Vnet:48128 -- The secret to enjoying your job is not to change your job but to change your attitude..
RE: File Upload Validator
hi, use controller maxFileSize=1M/ set this in struts-config for maxFileSize. look at file-upload-sample in your struts-distribution There cames an error, if the file is bigger. greetings matthias -Original Message- From: Patrick Scheuerer [mailto:[EMAIL PROTECTED] Sent: Monday, December 29, 2003 5:34 PM To: Struts Users List Subject: File Upload Validator Hi, I have to validate a form which collects all the data connected with a document. Allong with discriptive information there's also a html:file element to upload the file itself. So far use a DynaValidatorForm to do validation. Everything works fine for the text based form elements. I would also like to validate the file (FormFile) for size (it shouldn't be bigger than e.g. 1 MB) and MIME type (pdf, doc, exe, zip, etc.). Is there any extension for the Validator framework that can accomplish this? Of course I could write my own validator class, I'm just curious if something like this has been done already and is a readily available. Thanks, Patrick - 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]
Re: File Upload
What is it that you are trying to do? Is there a reason you can't just use a FormFile object in your form bean? That would make your life a whole lot easier - you wouldn't have to know or care about the request wrapper, and you wouldn't have to iterate over the uploaded fields. Also, I'm not sure where you're getting what you're trying to use in the code you posted. Are you trying to write a Struts app or a WebWork app? ServletActionContext is a WebWork class, not a Struts class, and getFileNames() and getFilesystemName() are WebWork methods as well, and not available on the Struts MultipartRequestWrapper class. Something is very wrong... -- Martin Cooper Jacob Ginu [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, This is the sample code I am using in the action.java file.I have the necessary struts file.But it says Unable to find ServletActionContext in MultipartRequestWrapper when compiled. MultipartRequestWrapper multiWrapper = (MultipartRequestWrapper) ServletActionContext.getRequest(); Enumeration e = multiWrapper.getFileNames(); while(e.hasMoreElements()) { // get the value of thisinput tag StringinputValue = (String) e.nextElement(); // get the content type StringcontentType = multiWrapper.getContentType(inputValue); // get the name of the file from the input tag StringfileName = multiWrapper.getFilesystemName(inputValue); // Get a File object forthe uploaded File File file = multiWrapper.getFile(inputValue); // If it's nullthe upload failed if(file == null) { addActionError(Error uploading: + multiWrapper.getFilesystemName(inputValue)); } David Friedman [EMAIL PROTECTED] wrote: Why won't you use the struts-upload.war from the Struts distributions? Regards, David -Original Message- From: Jacob Ginu [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 23, 2003 9:48 PM To: [EMAIL PROTECTED] Subject: reg:File Upload Hi, Can anyone send me a sample file Upload program. Regards, Ginu - Do you Yahoo!? Yahoo! Photos - Get your photo on the big screen in Times Square - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Yahoo! Photos - Get your photo on the big screen in Times Square - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: File Upload
Jacob, Did anyone ever get back to you on this? Where are you trying to get your MultiPartRequestWrapper? In an ActionForm subclass, you can use the method: getMultipartRequestHandler() In an Action subclass, you can do pull it from above using: MultipartRequestWrapper multiWrapper = (MultipartRequestWrapper) form.getMultipartRequestHandler(); OR, if there is no ActionForm defined for your Action subclass, create a new type of MultipartRequestHandler such as: CommonsMultipartRequestHandler cmrh = new CommonsMultipartRequestHandler(); cmrh.setServlet(servlet); cmrh.handleRequest(request); HashTable h = cmrh.getFileElements(); I used CommonsMultipartRequestHandler in my example (from an old post) but any appropriate MultiPartRequestHandler subclass should work. http://www.mail-archive.com/[EMAIL PROTECTED]/msg87269.html Just remember 2 things: a) only one file can be uploaded per file input field - someone tried to list many files in one upload field and kept seeing Exceptions thrown. b) if you are not using an ActionForm, there doesn't appear to be a MultiPartRequestHandler initialized, so create a new one like #2 above. Regards, David -Original Message- From: Jacob Ginu [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 23, 2003 10:03 PM To: Struts Users Mailing List Subject: RE: File Upload Hi, This is the sample code I am using in the action.java file.I have the necessary struts file.But it says Unable to find ServletActionContext in MultipartRequestWrapper when compiled. MultipartRequestWrapper multiWrapper = (MultipartRequestWrapper) ServletActionContext.getRequest(); Enumeration e = multiWrapper.getFileNames(); while(e.hasMoreElements()) { // get the value of thisinput tag StringinputValue = (String) e.nextElement(); // get the content type StringcontentType = multiWrapper.getContentType(inputValue); // get the name of the file from the input tag StringfileName = multiWrapper.getFilesystemName(inputValue); // Get a File object forthe uploaded File File file = multiWrapper.getFile(inputValue); // If it's nullthe upload failed if(file == null) { addActionError(Error uploading: + multiWrapper.getFilesystemName(inputValue)); } David Friedman [EMAIL PROTECTED] wrote: Why won't you use the struts-upload.war from the Struts distributions? Regards, David -Original Message- From: Jacob Ginu [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 23, 2003 9:48 PM To: [EMAIL PROTECTED] Subject: reg:File Upload Hi, Can anyone send me a sample file Upload program. Regards, Ginu - Do you Yahoo!? Yahoo! Photos - Get your photo on the big screen in Times Square - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Yahoo! Photos - Get your photo on the big screen in Times Square - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: File Upload
David, No one has got back to me on this except you.There seems to be not much info regarding this.Iam going throught the link you sent me. I tried to call MultipartRequestWrapper from an action subclass.I was not successful in it. Thanx for your response. Regards, Ginu Jacob David Friedman [EMAIL PROTECTED] wrote: Jacob, Did anyone ever get back to you on this? Where are you trying to get your MultiPartRequestWrapper? In an ActionForm subclass, you can use the method: getMultipartRequestHandler() In an Action subclass, you can do pull it from above using: MultipartRequestWrapper multiWrapper = (MultipartRequestWrapper) form.getMultipartRequestHandler(); OR, if there is no ActionForm defined for your Action subclass, create a new type of MultipartRequestHandler such as: CommonsMultipartRequestHandler cmrh = new CommonsMultipartRequestHandler(); cmrh.setServlet(servlet); cmrh.handleRequest(request); HashTable h = cmrh.getFileElements(); I used CommonsMultipartRequestHandler in my example (from an old post) but any appropriate MultiPartRequestHandler subclass should work. http://www.mail-archive.com/[EMAIL PROTECTED]/msg87269.html Just remember 2 things: a) only one file can be uploaded per file input field - someone tried to list many files in one upload field and kept seeing Exceptions thrown. b) if you are not using an ActionForm, there doesn't appear to be a MultiPartRequestHandler initialized, so create a new one like #2 above. Regards, David -Original Message- From: Jacob Ginu [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 23, 2003 10:03 PM To: Struts Users Mailing List Subject: RE: File Upload Hi, This is the sample code I am using in the action.java file.I have the necessary struts file.But it says Unable to find ServletActionContext in MultipartRequestWrapper when compiled. MultipartRequestWrapper multiWrapper = (MultipartRequestWrapper) ServletActionContext.getRequest(); Enumeration e = multiWrapper.getFileNames(); while(e.hasMoreElements()) { // get the value of thisinput tag StringinputValue = (String) e.nextElement(); // get the content type StringcontentType = multiWrapper.getContentType(inputValue); // get the name of the file from the input tag StringfileName = multiWrapper.getFilesystemName(inputValue); // Get a File object forthe uploaded File File file = multiWrapper.getFile(inputValue); // If it's nullthe upload failed if(file == null) { addActionError(Error uploading: + multiWrapper.getFilesystemName(inputValue)); } David Friedman wrote: Why won't you use the struts-upload.war from the Struts distributions? Regards, David -Original Message- From: Jacob Ginu [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 23, 2003 9:48 PM To: [EMAIL PROTECTED] Subject: reg:File Upload Hi, Can anyone send me a sample file Upload program. Regards, Ginu - Do you Yahoo!? Yahoo! Photos - Get your photo on the big screen in Times Square - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Yahoo! Photos - Get your photo on the big screen in Times Square - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Yahoo! Photos - Get your photo on the big screen in Times Square
RE: File Upload
Jacob, That post was all from working examples I had while looking into the problem (I was curious when I read the original post back then). Let me know if I can assist you with anything. Feel free to post your ActionForm and Action subclasses for assistance. Regards, David -Original Message- From: Jacob Ginu [mailto:[EMAIL PROTECTED] Sent: Thursday, December 25, 2003 9:30 PM To: Struts Users Mailing List Subject: RE: File Upload David, No one has got back to me on this except you.There seems to be not much info regarding this.Iam going throught the link you sent me. I tried to call MultipartRequestWrapper from an action subclass.I was not successful in it. Thanx for your response. Regards, Ginu Jacob David Friedman [EMAIL PROTECTED] wrote: Jacob, Did anyone ever get back to you on this? Where are you trying to get your MultiPartRequestWrapper? In an ActionForm subclass, you can use the method: getMultipartRequestHandler() In an Action subclass, you can do pull it from above using: MultipartRequestWrapper multiWrapper = (MultipartRequestWrapper) form.getMultipartRequestHandler(); OR, if there is no ActionForm defined for your Action subclass, create a new type of MultipartRequestHandler such as: CommonsMultipartRequestHandler cmrh = new CommonsMultipartRequestHandler(); cmrh.setServlet(servlet); cmrh.handleRequest(request); HashTable h = cmrh.getFileElements(); I used CommonsMultipartRequestHandler in my example (from an old post) but any appropriate MultiPartRequestHandler subclass should work. http://www.mail-archive.com/[EMAIL PROTECTED]/msg87269.html Just remember 2 things: a) only one file can be uploaded per file input field - someone tried to list many files in one upload field and kept seeing Exceptions thrown. b) if you are not using an ActionForm, there doesn't appear to be a MultiPartRequestHandler initialized, so create a new one like #2 above. Regards, David -Original Message- From: Jacob Ginu [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 23, 2003 10:03 PM To: Struts Users Mailing List Subject: RE: File Upload Hi, This is the sample code I am using in the action.java file.I have the necessary struts file.But it says Unable to find ServletActionContext in MultipartRequestWrapper when compiled. MultipartRequestWrapper multiWrapper = (MultipartRequestWrapper) ServletActionContext.getRequest(); Enumeration e = multiWrapper.getFileNames(); while(e.hasMoreElements()) { // get the value of thisinput tag StringinputValue = (String) e.nextElement(); // get the content type StringcontentType = multiWrapper.getContentType(inputValue); // get the name of the file from the input tag StringfileName = multiWrapper.getFilesystemName(inputValue); // Get a File object forthe uploaded File File file = multiWrapper.getFile(inputValue); // If it's nullthe upload failed if(file == null) { addActionError(Error uploading: + multiWrapper.getFilesystemName(inputValue)); } David Friedman wrote: Why won't you use the struts-upload.war from the Struts distributions? Regards, David -Original Message- From: Jacob Ginu [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 23, 2003 9:48 PM To: [EMAIL PROTECTED] Subject: reg:File Upload Hi, Can anyone send me a sample file Upload program. Regards, Ginu - Do you Yahoo!? Yahoo! Photos - Get your photo on the big screen in Times Square - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Yahoo! Photos - Get your photo on the big screen in Times Square - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Yahoo! Photos - Get your photo on the big screen in Times Square - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: File Upload
Why won't you use the struts-upload.war from the Struts distributions? Regards, David -Original Message- From: Jacob Ginu [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 23, 2003 9:48 PM To: [EMAIL PROTECTED] Subject: reg:File Upload Hi, Can anyone send me a sample file Upload program. Regards, Ginu - Do you Yahoo!? Yahoo! Photos - Get your photo on the big screen in Times Square - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: File Upload
Hi, This is the sample code I am using in the action.java file.I have the necessary struts file.But it says Unable to find ServletActionContext in MultipartRequestWrapper when compiled. MultipartRequestWrapper multiWrapper = (MultipartRequestWrapper) ServletActionContext.getRequest(); Enumeration e = multiWrapper.getFileNames(); while(e.hasMoreElements()) { // get the value of thisinput tag StringinputValue = (String) e.nextElement(); // get the content type StringcontentType = multiWrapper.getContentType(inputValue); // get the name of the file from the input tag StringfileName = multiWrapper.getFilesystemName(inputValue); // Get a File object forthe uploaded File File file = multiWrapper.getFile(inputValue); // If it's nullthe upload failed if(file == null) { addActionError(Error uploading: + multiWrapper.getFilesystemName(inputValue)); } David Friedman [EMAIL PROTECTED] wrote: Why won't you use the struts-upload.war from the Struts distributions? Regards, David -Original Message- From: Jacob Ginu [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 23, 2003 9:48 PM To: [EMAIL PROTECTED] Subject: reg:File Upload Hi, Can anyone send me a sample file Upload program. Regards, Ginu - Do you Yahoo!? Yahoo! Photos - Get your photo on the big screen in Times Square - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Yahoo! Photos - Get your photo on the big screen in Times Square
Re: file upload
i've not used dynaforms with fileupload so if that is the problem I couldn't say. you could try it with a normal formBean. However as the problem is trying to set a formfile using a string it looks like the problem could be in your jsp. have you set the enctype like below, html:form action=/blah enctype=multipart/form-data and the form property using html:file rather than html:text html:file property=pb_file/ goodluck, c On Friday 14 November 2003 13:38, sairam manda wrote: Hello Sir, I am new to sturts . I want to upload a file . I am using dynaform . these are snippets in the dynaform I used form-property name=pb_file type=org.apache.struts.upload.FormFile/ and in my action class I used the following code FormFile file = (FormFile) form.get(pb_file); I get the following error org.apache.commons.beanutils.ConversionException: Cannot assign value of type 'java.lang.String' to property 'pb_file' of type 'org.apache.struts.upload.FormFile' org.apache.struts.action.DynaActionForm.set(DynaActionFo rm.java:423) org.apache.commons.beanutils.PropertyUtils.setSimplePrope rty(PropertyUtils.java:1769) org.apache.commons.beanutils.PropertyUtils.setNestedPrope rty(PropertyUtils.java:1684) org.apache.commons.beanutils.PropertyUtils.setProperty(Pr opertyUtils.java:1713) org.apache.commons.beanutils.BeanUtils.setProperty(BeanUt ils.java:1019) org.apache.commons.beanutils.BeanUtils.populate(BeanUtils .java:808) org.apache.struts.util.RequestUtils.populate(RequestUtils .java:1252) org.apache.struts.action.RequestProcessor.processPopulate (RequestProcessor.java:821) org.apache.struts.action.RequestProcessor.process(Request Processor.java:254) org.apache.struts.action.ActionServlet.process(ActionServ let.java:1482) org.apache.struts.action.ActionServlet.doPost(ActionServl et.java:525) javax.servlet.http.HttpServlet.service(HttpServlet.java:7 63) javax.servlet.http.HttpServlet.service(HttpServlet.java:8 56) can somebody make me waware of the problem. regards sairam _ Enjoy shopping online? Get this e credit card. http://server1.msn.co.in/features/amex/ It cuts cost adds value! - 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]
Re: File upload problem with Struts 1.1
have you got the commons-upload jar in your lib dir? you need that as well as the struts jars. Also check your controller (in struts-config) has something like this (though i think it's optional actually), controller maxFileSize=300K / c On Wednesday 12 November 2003 08:18, Raman Garg wrote: Hi, We are getting error while file uploading using struts 1.1. We have a demo code for file uploading which demostrates the file uploading using struts. When we run there application code works fine but when we submit the form by setting enctype for the form it throws the following error. (Remember we are not doing anything in the action or in the form just getteer and setters) so issue is with enctype settings. It may use some internal class while sending data using enctype. Please advise us what to do. We downloaded the sample file uploading code from : http://forum.exadel.com/viewtopic.php?t=120 But according to me the problem can be with setting of enctype. follwoing is the code for our form html:form action=/ImageUploadSubmit enctype=multipart/form-data html:file property=fileName/ br html:submit value=Upload/ /html:form java.lang.NoSuchMethodError: org.apache.commons.fileupload.FileUpload.setSizeMax (I)V at org.apache.struts.upload.CommonsMultipartRequestHandler.h andleRequest (CommonsMultipartRequestHandler.java:219) at org.apache.struts.util.RequestUtils.populate(RequestUtils .java:1055) at org.apache.struts.action.RequestProcessor.processPopulate (RequestProcessor.java:798) at org.apache.struts.action.RequestProcessor.process (RequestProcessor.java:254) at org.apache.struts.action.ActionServlet.process (ActionServlet.java:1422) at org.apache.struts.action.ActionServlet.doPost(ActionServl et.java:523) at javax.servlet.http.HttpServlet.service(HttpServlet.java:7 60) at com.tavant.lg.controller.servlet.LoanGeniusFrontControlle rServlet.service (LoanGeniusFrontControllerServlet.java:81) at javax.servlet.http.HttpServlet.service(HttpServlet.java:8 53) at weblogic.servlet.internal.ServletStubImpl$ServletInvocati onAction.run (ServletStubImpl.java:1053) at weblogic.servlet.internal.ServletStubImpl.invokeServlet (ServletStubImpl.java:387) at weblogic.servlet.internal.ServletStubImpl.invokeServlet (ServletStubImpl.java:305) at weblogic.servlet.internal.WebAppServletContext$ServletInv ocationAction.run (WebAppServletContext.java:6291) at weblogic.security.acl.internal.AuthenticatedSubject.doAs (AuthenticatedSubject.java:317) at weblogic.security.service.SecurityManager.runAs (SecurityManager.java:97) at weblogic.servlet.internal.WebAppServletContext.invokeServ let (WebAppServletContext.java:3575) at weblogic.servlet.internal.ServletRequestImpl.execute (ServletRequestImpl.java:2573) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java: 178) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151) == Any Suggestion or help will be highly appreciated. Best Regards Raman Garg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File upload problem with Struts 1.1
Hi Connor, Thanks for your reply. We have the commons-upload.jar in the lib of our appliction directory and as well the struts.jar. We also have set the Controller size to 2MB which is quite nice for any file. If you want to see the error coming itself we can pass on the URL for our development server Any other suggestion will be appreciated . Looking forward to hear from you. Cheers Raman Garg - Original Message - From: Caoilte O'Connor [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 12, 2003 3:42 PM Subject: Re: File upload problem with Struts 1.1 have you got the commons-upload jar in your lib dir? you need that as well as the struts jars. Also check your controller (in struts-config) has something like this (though i think it's optional actually), controller maxFileSize=300K / c On Wednesday 12 November 2003 08:18, Raman Garg wrote: Hi, We are getting error while file uploading using struts 1.1. We have a demo code for file uploading which demostrates the file uploading using struts. When we run there application code works fine but when we submit the form by setting enctype for the form it throws the following error. (Remember we are not doing anything in the action or in the form just getteer and setters) so issue is with enctype settings. It may use some internal class while sending data using enctype. Please advise us what to do. We downloaded the sample file uploading code from : http://forum.exadel.com/viewtopic.php?t=120 But according to me the problem can be with setting of enctype. follwoing is the code for our form html:form action=/ImageUploadSubmit enctype=multipart/form-data html:file property=fileName/ br html:submit value=Upload/ /html:form java.lang.NoSuchMethodError: org.apache.commons.fileupload.FileUpload.setSizeMax (I)V at org.apache.struts.upload.CommonsMultipartRequestHandler.h andleRequest (CommonsMultipartRequestHandler.java:219) at org.apache.struts.util.RequestUtils.populate(RequestUtils .java:1055) at org.apache.struts.action.RequestProcessor.processPopulate (RequestProcessor.java:798) at org.apache.struts.action.RequestProcessor.process (RequestProcessor.java:254) at org.apache.struts.action.ActionServlet.process (ActionServlet.java:1422) at org.apache.struts.action.ActionServlet.doPost(ActionServl et.java:523) at javax.servlet.http.HttpServlet.service(HttpServlet.java:7 60) at com.tavant.lg.controller.servlet.LoanGeniusFrontControlle rServlet.service (LoanGeniusFrontControllerServlet.java:81) at javax.servlet.http.HttpServlet.service(HttpServlet.java:8 53) at weblogic.servlet.internal.ServletStubImpl$ServletInvocati onAction.run (ServletStubImpl.java:1053) at weblogic.servlet.internal.ServletStubImpl.invokeServlet (ServletStubImpl.java:387) at weblogic.servlet.internal.ServletStubImpl.invokeServlet (ServletStubImpl.java:305) at weblogic.servlet.internal.WebAppServletContext$ServletInv ocationAction.run (WebAppServletContext.java:6291) at weblogic.security.acl.internal.AuthenticatedSubject.doAs (AuthenticatedSubject.java:317) at weblogic.security.service.SecurityManager.runAs (SecurityManager.java:97) at weblogic.servlet.internal.WebAppServletContext.invokeServ let (WebAppServletContext.java:3575) at weblogic.servlet.internal.ServletRequestImpl.execute (ServletRequestImpl.java:2573) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java: 178) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151) == Any Suggestion or help will be highly appreciated. Best Regards Raman Garg - 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]
Re: File upload problem with Struts 1.1
hi, are you using a struts nightly build? it appears that might require a different version of commons-upload (cvs probably). c On Wednesday 12 November 2003 11:20, Garg Raman \(SDinc\) wrote: Hi Connor, Thanks for your reply. We have the commons-upload.jar in the lib of our appliction directory and as well the struts.jar. We also have set the Controller size to 2MB which is quite nice for any file. If you want to see the error coming itself we can pass on the URL for our development server Any other suggestion will be appreciated . Looking forward to hear from you. Cheers Raman Garg - Original Message - From: Caoilte O'Connor [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 12, 2003 3:42 PM Subject: Re: File upload problem with Struts 1.1 have you got the commons-upload jar in your lib dir? you need that as well as the struts jars. Also check your controller (in struts-config) has something like this (though i think it's optional actually), controller maxFileSize=300K / c On Wednesday 12 November 2003 08:18, Raman Garg wrote: Hi, We are getting error while file uploading using struts 1.1. We have a demo code for file uploading which demostrates the file uploading using struts. When we run there application code works fine but when we submit the form by setting enctype for the form it throws the following error. (Remember we are not doing anything in the action or in the form just getteer and setters) so issue is with enctype settings. It may use some internal class while sending data using enctype. Please advise us what to do. We downloaded the sample file uploading code from : http://forum.exadel.com/viewtopic.php?t=120 But according to me the problem can be with setting of enctype. follwoing is the code for our form html:form action=/ImageUploadSubmit enctype=multipart/form-data html:file property=fileName/ br html:submit value=Upload/ /html:form java.lang.NoSuchMethodError: org.apache.commons.fileupload.FileUpload.setSizeMax (I)V at org.apache.struts.upload.CommonsMultipartRequestHandl er.h andleRequest (CommonsMultipartRequestHandler.java:219) at org.apache.struts.util.RequestUtils.populate(RequestU tils .java:1055) at org.apache.struts.action.RequestProcessor.processPopu late (RequestProcessor.java:798) at org.apache.struts.action.RequestProcessor.process (RequestProcessor.java:254) at org.apache.struts.action.ActionServlet.process (ActionServlet.java:1422) at org.apache.struts.action.ActionServlet.doPost(ActionS ervl et.java:523) at javax.servlet.http.HttpServlet.service(HttpServlet.ja va:7 60) at com.tavant.lg.controller.servlet.LoanGeniusFrontContr olle rServlet.service (LoanGeniusFrontControllerServlet.java:81) at javax.servlet.http.HttpServlet.service(HttpServlet.ja va:8 53) at weblogic.servlet.internal.ServletStubImpl$ServletInvo cati onAction.run (ServletStubImpl.java:1053) at weblogic.servlet.internal.ServletStubImpl.invokeServl et (ServletStubImpl.java:387) at weblogic.servlet.internal.ServletStubImpl.invokeServl et (ServletStubImpl.java:305) at weblogic.servlet.internal.WebAppServletContext$Servle tInv ocationAction.run (WebAppServletContext.java:6291) at weblogic.security.acl.internal.AuthenticatedSubject.d oAs (AuthenticatedSubject.java:317) at weblogic.security.service.SecurityManager.runAs (SecurityManager.java:97) at weblogic.servlet.internal.WebAppServletContext.invoke Serv let (WebAppServletContext.java:3575) at weblogic.servlet.internal.ServletRequestImpl.execute (ServletRequestImpl.java:2573) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.j ava: 178) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java: 151) == Any Suggestion or help will be highly appreciated. Best Regards Raman Garg --- -- 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]
Re: File upload problem with Struts 1.1
This usually happens when you have your jars in the wrong place and your container also includes (a different version of) FileUpload. Make sure that the Commons FileUpload jar file, as well as the Struts jar file and other Commons jar files, are in your WEB-INF/lib directory, and not in a container-specific lib directory. -- Martin Cooper Raman Garg [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, We are getting error while file uploading using struts 1.1. We have a demo code for file uploading which demostrates the file uploading using struts. When we run there application code works fine but when we submit the form by setting enctype for the form it throws the following error. (Remember we are not doing anything in the action or in the form just getteer and setters) so issue is with enctype settings. It may use some internal class while sending data using enctype. Please advise us what to do. We downloaded the sample file uploading code from : http://forum.exadel.com/viewtopic.php?t=120 But according to me the problem can be with setting of enctype. follwoing is the code for our form html:form action=/ImageUploadSubmit enctype=multipart/form-data html:file property=fileName/ br html:submit value=Upload/ /html:form java.lang.NoSuchMethodError: org.apache.commons.fileupload.FileUpload.setSizeMax (I)V at org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest (CommonsMultipartRequestHandler.java:219) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1055) at org.apache.struts.action.RequestProcessor.processPopulate (RequestProcessor.java:798) at org.apache.struts.action.RequestProcessor.process (RequestProcessor.java:254) at org.apache.struts.action.ActionServlet.process (ActionServlet.java:1422) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at com.tavant.lg.controller.servlet.LoanGeniusFrontControllerServlet.service (LoanGeniusFrontControllerServlet.java:81) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run (ServletStubImpl.java:1053) at weblogic.servlet.internal.ServletStubImpl.invokeServlet (ServletStubImpl.java:387) at weblogic.servlet.internal.ServletStubImpl.invokeServlet (ServletStubImpl.java:305) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run (WebAppServletContext.java:6291) at weblogic.security.acl.internal.AuthenticatedSubject.doAs (AuthenticatedSubject.java:317) at weblogic.security.service.SecurityManager.runAs (SecurityManager.java:97) at weblogic.servlet.internal.WebAppServletContext.invokeServlet (WebAppServletContext.java:3575) at weblogic.servlet.internal.ServletRequestImpl.execute (ServletRequestImpl.java:2573) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:178) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151) == Any Suggestion or help will be highly appreciated. Best Regards Raman Garg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: file upload and IllegalArgumentException:
Hi, the enc-type is described in the jsp. in Struts-config I just have : form-beans form-bean name=serverForm type=com.orange.struts.beans.servers.ServerForm/ /form-beans action name=serverForm path=/doServer input=/doServer.do scope=request type=com.orange.struts.actions.servers.ServerAction parameter=action forward name=success path=/index.jsp redirect=false/ /action But since yesterday I've tested the other actions where I use formfile In my Struts applications I ve this exception everywhere I think I've upgraded a jar somewhere causing this error (I'm actually looking the commons lib versions) Regards -- Franck Lefebure equipe web http://www.orangecaraibe.com mailto:[EMAIL PROTECTED] - Original Message - From: k_emilov [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 02, 2003 3:59 AM Subject: multipart-form/data enc type Hi , I think , the problem is that you describe enc type in struts- config.xml ... If you describe it in the .jsp html:form action=/doServer enctype=multipart/form-data , it will not attempt to set FormFile property with an empty string , causing illegal argument exception There is another workaround, certainly - not to define form property of type FormFile in xml, but to take it from requesyt object. Please , reply what happened Regards Konstantin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: file upload and IllegalArgumentException: FOUND !
Well, I've found the problem, It wasn't my code .. It wasn't commons libraries ... I recently upgraded my Opera Browser version : 7.20.3087. This version of Opera doesn't seem to support use of Formfile (if you leave a file input blank) can anyone confirm that ? I would like to do a bug report but I've never done something like that and I don't know if it's a Struts or an Opera bug . any council ? Franck Lefebure equipe web http://www.orangecaraibe.com mailto:[EMAIL PROTECTED] - Original Message - From: Franck Lefebure [EMAIL PROTECTED] To: k_emilov [EMAIL PROTECTED]; 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Thursday, October 02, 2003 9:15 AM Subject: Re: file upload and IllegalArgumentException: Hi, the enc-type is described in the jsp. in Struts-config I just have : form-beans form-bean name=serverForm type=com.orange.struts.beans.servers.ServerForm/ /form-beans action name=serverForm path=/doServer input=/doServer.do scope=request type=com.orange.struts.actions.servers.ServerAction parameter=action forward name=success path=/index.jsp redirect=false/ /action But since yesterday I've tested the other actions where I use formfile In my Struts applications I ve this exception everywhere I think I've upgraded a jar somewhere causing this error (I'm actually looking the commons lib versions) Regards -- Franck Lefebure equipe web http://www.orangecaraibe.com mailto:[EMAIL PROTECTED] - Original Message - From: k_emilov [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 02, 2003 3:59 AM Subject: multipart-form/data enc type Hi , I think , the problem is that you describe enc type in struts- config.xml ... If you describe it in the .jsp html:form action=/doServer enctype=multipart/form-data , it will not attempt to set FormFile property with an empty string , causing illegal argument exception There is another workaround, certainly - not to define form property of type FormFile in xml, but to take it from requesyt object. Please , reply what happened Regards Konstantin - 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]
Re: File Upload and Request Parameter
David Stemm wrote: All, I have a form that is doing a file upload and on the confirmation page after the upload I'm trying to get a request parameter using the c:out tag. The tag doesn't seem to find the request param. I know the parameter exists - I can see it in the debugger. The tag looks like this: c:out value=${param.action}/ and I tried this as well c:out value=${param['action']}/. I believe the problem is because the form is setup to use multipart/form-data. Any ideas on this? Thanks. There is a note in the request.getParameter() JavaDocs that states: If the parameter data was sent in the request body, such as occurs with an HTTP POST request, then reading the body directly via getInputStream() or getReader() can interfere with the execution of this method. You have probably used some package like FileUpload to handle the file. This package would be using the getInputStream() to extract the contents of the uploaded file (this is why you cannot access the parameters normally). This package should also provide some method of accessing any formfields or parameters that were passed. FileUpload package: http://jakarta.apache.org/commons/fileupload (I haven't used this myself) It looks like you could use this in your action to get a list of FileItems (some will be uploaded files which you can save to disk, the others would be form fields). When you find a form field, you could try adding it to the request using request.setAttribute(), which should allow you to access it using c:out. -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: File Upload error
Make sure you do not have another file upload jar in your classpath. Where are you hosting your app, what OS? Alex. -Original Message- From: Erez Efrati [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2003 11:14 AM To: 'Struts Users Mailing List' Subject: File Upload error Hi, I am trying to do file uploading of several files and I keep getting the following error: java.lang.NoSuchMethodError: org.apache.commons.fileupload.MultipartStream.setHeaderEncoding(Ljava/la ng/String;)V I am using JBoss/Tomcat 4.1.24. The upload struts sample works just fine under 4.1.27 - I haven't tried it under 4.1.24. Does anyone have a clue? Thanks, Erez - 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]
RE: File Upload error
Alex, I found it!! It was a beta version of the FileUpload in the JBoss/Tomcat-4.1.24. I just replaced it with the FileUpload 1.0 that came with Struts and it works now, thank god :) Erez -Original Message- From: Alex Shneyderman [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2003 4:48 PM To: 'Struts Users Mailing List' Subject: RE: File Upload error Make sure you do not have another file upload jar in your classpath. Where are you hosting your app, what OS? Alex. -Original Message- From: Erez Efrati [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2003 11:14 AM To: 'Struts Users Mailing List' Subject: File Upload error Hi, I am trying to do file uploading of several files and I keep getting the following error: java.lang.NoSuchMethodError: org.apache.commons.fileupload.MultipartStream.setHeaderEncoding(Ljava/la ng/String;)V I am using JBoss/Tomcat 4.1.24. The upload struts sample works just fine under 4.1.27 - I haven't tried it under 4.1.24. Does anyone have a clue? Thanks, Erez - 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]
RE: file upload problem
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
RE: file upload problem
Hi Brian, Thanks for replying. I really need help here, cause this is my first time I am dealing with this. All I wanted to know is how should and can I handle uploads of files which are then being accessed intensively. Up to now I've seen two ways to do this: (1) Store the uploaded files in the database and have a Struts Action serve those files from the DB. Pros: - The action has an ultimate control on who access what - The files are better secured Cons: - might turn up slow, even too slow to not acceptable (2) Store those uploaded files under a file system directory and have the JSP pages access these files through an Action or direct access, like any normal image, logo, etc. * Using an action - again, gaining control over the access, but might be slower then direct access. * Using direct access - probably faster (don't know how much more, though), but losing control over pages access, less secured. To do this I thought also of using Apache as the front door, using the alias directive + JK2 module, which I guess you are familiar with. Of course using Apache as the front door led me to the question of: do I need it really, is it that important to have the Apache just for the files. Many people argue that using Apache is best for static files, and I guess images, photos, etc. *are* static in nature, so why not. Still I did find that the configuration is a bit awkward, however it can work. Do you use Apache for that as well? Or just Tomcat? True, first I wanted to go along and delay my decision of how to access those files and just have a file system directory. But I saw that JBoss deletes those directories upon packed deployment. In your solution I have to deploy in an unpacked manner even in production. Otherwise the whole directory will get lost. Do you see any problems with your way? It's really sad that there is not way to declare in JBoss/Tomcat a directory with characteristics similar to the alias url-path dir-path in Apache. I don't see why it is not there, am I the only one to deal with this kind of requirement? I guess not :) Regards, Erez -Original Message- From: Brian McSweeney [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 20, 2003 11:59 AM To: 'Struts Users Mailing List' Subject: RE: file upload problem 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
Re: File Upload Data
Steven, I had a problem like that where nothing was being uploaded because my form enctype was not set to 'multipart/form-data'. Then again, the problem was when I was programming in Perl under Apache + NT and migrating it to Perl under Apache + Linux, so it's not quite the Struts-Upload related answer you were probably looking for, huh? :( Regards, David ---Original Message--- From: Steven Leija [EMAIL PROTECTED] Sent: 08/20/03 08:58 AM To: Struts Users Mailing List [EMAIL PROTECTED] Subject: File Upload Data Hello All, I'm running into a really weird problem. I'm uploading a file in windows and the input stream is just fine. But when I deploy my application to a linux box, the same upload failes. I traced this down to the fact that the input stream is empty. The file is being uploaded but the stream is coming in as null. I've verified these files are not corrupt or empty. Has anyone seen this before? Thanks, Steven - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File Upload Data
I have run the same code for my file uploads in windows and linux without a problem. Shane - Original Message - From: David G. Friedman [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, August 20, 2003 7:13 AM Subject: Re: File Upload Data Steven, I had a problem like that where nothing was being uploaded because my form enctype was not set to 'multipart/form-data'. Then again, the problem was when I was programming in Perl under Apache + NT and migrating it to Perl under Apache + Linux, so it's not quite the Struts-Upload related answer you were probably looking for, huh? :( Regards, David ---Original Message--- From: Steven Leija [EMAIL PROTECTED] Sent: 08/20/03 08:58 AM To: Struts Users Mailing List [EMAIL PROTECTED] Subject: File Upload Data Hello All, I'm running into a really weird problem. I'm uploading a file in windows and the input stream is just fine. But when I deploy my application to a linux box, the same upload failes. I traced this down to the fact that the input stream is empty. The file is being uploaded but the stream is coming in as null. I've verified these files are not corrupt or empty. Has anyone seen this before? Thanks, Steven - 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]
RE: file upload problem - FileNotFoundException
Sounds like we're having similar problems. I'm using JBoss. I got that problem when I didn't have the commons-fileupload.jar in my ejb server's classpath. I know you said you have that, but make sure! -Original Message- From: Kuba [mailto:[EMAIL PROTECTED] Sent: 18 August 2003 10:31 To: [EMAIL PROTECTED] Subject: file upload problem - FileNotFoundException I have a weird problem using fileupload. Exception stack is (I'm using IBM WSAD): [03-08-18 08:50:34:577 CEST] 613ea32e RequestProces I org.apache.struts.action.RequestProcessor Processing a 'POST' for path '/updateTicket' [03-08-18 08:50:35:027 CEST] 613ea32e WebGroup E SRVE0026E: [Servlet Error]-[org/apache/commons/fileupload/FileUploadException]: java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileUploadException at java.lang.Class.newInstance0(Native Method) at java.lang.Class.newInstance(Class.java:262) at org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.jav a:21 9) at org.apache.struts.util.RequestUtils.getMultipartHandler(RequestUtils.jav a:10 46) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:919) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcess or.j ava:779) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java: 246) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292) it is done after trying to post a form with enctype multipart/form-data Class org/apache/commons/fileupload/FileUploadException is present in attached jar (commons-fileupload) and that makes my confusion even bigger.. what is interesting, this error doesn't occur when I exclude EJB Server from the project(so this error doesn't result from bad configured webproject)...Until this time everything in my application seemed OK... Has anybody ever had something similar and is able to help me? I'll be very grateful... - 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]
Re: file upload problem - FileNotFoundException
Sounds like we're having similar problems. I'm using JBoss. I got that problem when I didn't have the commons-fileupload.jar in my ejb server's classpath. I know you said you have that, but make sure! i don't think it's the same problem... there is something wrong with my ejb project (my ear consists of webProject ejbProject) because when i attach sample AutoWorldExample.war everything is OK :/ i'm asking if someone have had similar problem and then i'll know what could have gone wrong... i'm reminding the problem: Servlet Error]-[org/apache/commons/fileupload/FileUploadException]: java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileUploadException at java.lang.Class.newInstance0(Native Method) at java.lang.Class.newInstance(Class.java:262) at org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.jav a:219) at org.apache.struts.util.RequestUtils.getMultipartHandler(RequestUtils.jav a:1046) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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
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]
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]
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]
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]
Re: file upload problem
Erez Efrati wrote: I am dealing as well with the file upload issue: 2) I could always store those files in the database but then I would have to access them through an action, is this wise? Yes. I'm a strong proponent of storage in a database. Not only is a BLOB the ultimate quarantine but it saves you the headache of keeping meta-data and and the file content in synch. Most RDBMs implement BLOBs as files so there is very little performance hit when you perform the upload. When users perform the download you will need an action to 'proxy' the bytes from the database to the response. If you write good java.io code, set the content type on the response and return null from the execute method this is pretty straightforward and fast enough for most applications. Downloads will be a little slower this way but it's rare for system requirements to necessitate repeated file download. If _each_ file is going to be downloaded more than a few hundred times/day you might want to write it to directory served by your _web_ server. Don't forget virus protection. If users can upload and download MS Office documents you will need to virus check them after they are uploaded but before anyone else can download them. Regards, Evan. -- Evan Schnell, Project Lead nVISIA, Twin Cities Enterprise Architecture and Construction http://www.nvisia.com 7701 France Ave. S, Edina, MN 55435 Voice: 952.837.2577 -- Fax: 952.837.2578 smime.p7s Description: S/MIME Cryptographic Signature
RE: file upload problem
Thing is I do need a very high downloading of files, so I guess the directory option is more appropriate. What do you mean by a directory served by your web server? I am working with JBoss/Tomact and each time I am redeploy the any directory under the context is deleted. So is there a trick here that I missed ? Thanks, Erez -Original Message- From: Evan Schnell [mailto:[EMAIL PROTECTED] Sent: Monday, August 18, 2003 4:24 PM To: Struts Users Mailing List Subject: Re: file upload problem Erez Efrati wrote: I am dealing as well with the file upload issue: 2) I could always store those files in the database but then I would have to access them through an action, is this wise? Yes. I'm a strong proponent of storage in a database. Not only is a BLOB the ultimate quarantine but it saves you the headache of keeping meta-data and and the file content in synch. Most RDBMs implement BLOBs as files so there is very little performance hit when you perform the upload. When users perform the download you will need an action to 'proxy' the bytes from the database to the response. If you write good java.io code, set the content type on the response and return null from the execute method this is pretty straightforward and fast enough for most applications. Downloads will be a little slower this way but it's rare for system requirements to necessitate repeated file download. If _each_ file is going to be downloaded more than a few hundred times/day you might want to write it to directory served by your _web_ server. Don't forget virus protection. If users can upload and download MS Office documents you will need to virus check them after they are uploaded but before anyone else can download them. Regards, Evan. -- Evan Schnell, Project Lead nVISIA, Twin Cities Enterprise Architecture and Construction http://www.nvisia.com 7701 France Ave. S, Edina, MN 55435 Voice: 952.837.2577 -- Fax: 952.837.2578 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[ot] Virus checking blobs was [Re: file upload problem]
Evan That's interesting about storing files as BLOB's and the bit about viruses checking. How do the mechanics of the virus checking work? Are there any virus checkers that can check while everything's stored in the db? Sounds interesting. Cheers Mark On Monday, August 18, 2003, at 03:24 PM, Evan Schnell wrote: Erez Efrati wrote: I am dealing as well with the file upload issue: 2) I could always store those files in the database but then I would have to access them through an action, is this wise? Yes. I'm a strong proponent of storage in a database. Not only is a BLOB the ultimate quarantine but it saves you the headache of keeping meta-data and and the file content in synch. Most RDBMs implement BLOBs as files so there is very little performance hit when you perform the upload. When users perform the download you will need an action to 'proxy' the bytes from the database to the response. If you write good java.io code, set the content type on the response and return null from the execute method this is pretty straightforward and fast enough for most applications. Downloads will be a little slower this way but it's rare for system requirements to necessitate repeated file download. If _each_ file is going to be downloaded more than a few hundred times/day you might want to write it to directory served by your _web_ server. Don't forget virus protection. If users can upload and download MS Office documents you will need to virus check them after they are uploaded but before anyone else can download them. Regards, Evan. -- Evan Schnell, Project Lead nVISIA, Twin Cities Enterprise Architecture and Construction http://www.nvisia.com 7701 France Ave. S, Edina, MN 55435 Voice: 952.837.2577 -- Fax: 952.837.2578 smime.p7s - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: file upload problem
I would also love to know the solution to this problem. I'm doing the exact same thing as you Erez. Also working with JBoss_Tomcat. Is there some way to tell tomcat to serve files from a specific directory outside the context root? -Original Message- From: Erez Efrati [mailto:[EMAIL PROTECTED] Sent: 18 August 2003 16:33 To: 'Struts Users Mailing List' Subject: RE: file upload problem Thing is I do need a very high downloading of files, so I guess the directory option is more appropriate. What do you mean by a directory served by your web server? I am working with JBoss/Tomact and each time I am redeploy the any directory under the context is deleted. So is there a trick here that I missed ? Thanks, Erez -Original Message- From: Evan Schnell [mailto:[EMAIL PROTECTED] Sent: Monday, August 18, 2003 4:24 PM To: Struts Users Mailing List Subject: Re: file upload problem Erez Efrati wrote: I am dealing as well with the file upload issue: 2) I could always store those files in the database but then I would have to access them through an action, is this wise? Yes. I'm a strong proponent of storage in a database. Not only is a BLOB the ultimate quarantine but it saves you the headache of keeping meta-data and and the file content in synch. Most RDBMs implement BLOBs as files so there is very little performance hit when you perform the upload. When users perform the download you will need an action to 'proxy' the bytes from the database to the response. If you write good java.io code, set the content type on the response and return null from the execute method this is pretty straightforward and fast enough for most applications. Downloads will be a little slower this way but it's rare for system requirements to necessitate repeated file download. If _each_ file is going to be downloaded more than a few hundred times/day you might want to write it to directory served by your _web_ server. Don't forget virus protection. If users can upload and download MS Office documents you will need to virus check them after they are uploaded but before anyone else can download them. Regards, Evan. -- Evan Schnell, Project Lead nVISIA, Twin Cities Enterprise Architecture and Construction http://www.nvisia.com 7701 France Ave. S, Edina, MN 55435 Voice: 952.837.2577 -- Fax: 952.837.2578 - 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]
Re: [ot] Virus checking blobs was [Re: file upload problem]
Mark Lowe wrote: Evan That's interesting about storing files as BLOB's and the bit about viruses checking. How do the mechanics of the virus checking work? Are there any virus checkers that can check while everything's stored in the db? Sounds interesting. I doubt something is out there that could actually scan BLOBs, especially platform independently. I've yet to even find a type-4 :) virus checker. Instead, I've used a J2EE application client on a separate machine from the production server. This client uses a native virus scanner to check the files. Once the file is checked the app client sets a flag on the EJB allowing users to see the file. Regards, Evan. -- Evan Schnell, Project Lead nVISIA, Twin Cities Enterprise Architecture and Construction http://www.nvisia.com/ 7701 France Ave. S, Edina, MN 55435 Voice: 952.837.2577 -- Fax: 952.837.2578 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: file upload problem
Generally I add a virtual directory to my web container. This allows you to map a context root to any directory on the server (keeping permissions in mind). For example http://webroot/file would map to a directory /tmp/uploads. I proxy my web applications through Apache so I generally add an Alias entry to the virtual host. You will have to check your container's docs for your specific environment. -Shane -Original Message- From: Brian McSweeney [mailto:[EMAIL PROTECTED] Sent: Monday, August 18, 2003 10:47 AM To: 'Struts Users Mailing List' Subject: RE: file upload problem I would also love to know the solution to this problem. I'm doing the exact same thing as you Erez. Also working with JBoss_Tomcat. Is there some way to tell tomcat to serve files from a specific directory outside the context root? -Original Message- From: Erez Efrati [mailto:[EMAIL PROTECTED] Sent: 18 August 2003 16:33 To: 'Struts Users Mailing List' Subject: RE: file upload problem Thing is I do need a very high downloading of files, so I guess the directory option is more appropriate. What do you mean by a directory served by your web server? I am working with JBoss/Tomact and each time I am redeploy the any directory under the context is deleted. So is there a trick here that I missed ? Thanks, Erez -Original Message- From: Evan Schnell [mailto:[EMAIL PROTECTED] Sent: Monday, August 18, 2003 4:24 PM To: Struts Users Mailing List Subject: Re: file upload problem Erez Efrati wrote: I am dealing as well with the file upload issue: 2) I could always store those files in the database but then I would have to access them through an action, is this wise? Yes. I'm a strong proponent of storage in a database. Not only is a BLOB the ultimate quarantine but it saves you the headache of keeping meta-data and and the file content in synch. Most RDBMs implement BLOBs as files so there is very little performance hit when you perform the upload. When users perform the download you will need an action to 'proxy' the bytes from the database to the response. If you write good java.io code, set the content type on the response and return null from the execute method this is pretty straightforward and fast enough for most applications. Downloads will be a little slower this way but it's rare for system requirements to necessitate repeated file download. If _each_ file is going to be downloaded more than a few hundred times/day you might want to write it to directory served by your _web_ server. Don't forget virus protection. If users can upload and download MS Office documents you will need to virus check them after they are uploaded but before anyone else can download them. Regards, Evan. -- Evan Schnell, Project Lead nVISIA, Twin Cities Enterprise Architecture and Construction http://www.nvisia.com 7701 France Ave. S, Edina, MN 55435 Voice: 952.837.2577 -- Fax: 952.837.2578 - 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]
RE: file upload problem
Thanks Shane, Will try this approach. Brian -Original Message- From: Witbeck, Shane [mailto:[EMAIL PROTECTED] Sent: 18 August 2003 16:10 To: [EMAIL PROTECTED] Subject: RE: file upload problem Generally I add a virtual directory to my web container. This allows you to map a context root to any directory on the server (keeping permissions in mind). For example http://webroot/file would map to a directory /tmp/uploads. I proxy my web applications through Apache so I generally add an Alias entry to the virtual host. You will have to check your container's docs for your specific environment. -Shane -Original Message- From: Brian McSweeney [mailto:[EMAIL PROTECTED] Sent: Monday, August 18, 2003 10:47 AM To: 'Struts Users Mailing List' Subject: RE: file upload problem I would also love to know the solution to this problem. I'm doing the exact same thing as you Erez. Also working with JBoss_Tomcat. Is there some way to tell tomcat to serve files from a specific directory outside the context root? -Original Message- From: Erez Efrati [mailto:[EMAIL PROTECTED] Sent: 18 August 2003 16:33 To: 'Struts Users Mailing List' Subject: RE: file upload problem Thing is I do need a very high downloading of files, so I guess the directory option is more appropriate. What do you mean by a directory served by your web server? I am working with JBoss/Tomact and each time I am redeploy the any directory under the context is deleted. So is there a trick here that I missed ? Thanks, Erez -Original Message- From: Evan Schnell [mailto:[EMAIL PROTECTED] Sent: Monday, August 18, 2003 4:24 PM To: Struts Users Mailing List Subject: Re: file upload problem Erez Efrati wrote: I am dealing as well with the file upload issue: 2) I could always store those files in the database but then I would have to access them through an action, is this wise? Yes. I'm a strong proponent of storage in a database. Not only is a BLOB the ultimate quarantine but it saves you the headache of keeping meta-data and and the file content in synch. Most RDBMs implement BLOBs as files so there is very little performance hit when you perform the upload. When users perform the download you will need an action to 'proxy' the bytes from the database to the response. If you write good java.io code, set the content type on the response and return null from the execute method this is pretty straightforward and fast enough for most applications. Downloads will be a little slower this way but it's rare for system requirements to necessitate repeated file download. If _each_ file is going to be downloaded more than a few hundred times/day you might want to write it to directory served by your _web_ server. Don't forget virus protection. If users can upload and download MS Office documents you will need to virus check them after they are uploaded but before anyone else can download them. Regards, Evan. -- Evan Schnell, Project Lead nVISIA, Twin Cities Enterprise Architecture and Construction http://www.nvisia.com 7701 France Ave. S, Edina, MN 55435 Voice: 952.837.2577 -- Fax: 952.837.2578 - 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]
Re: File Upload with Mac IE
I found that the cause is html:image / tag. (BI replaced html:image / with html:submit /, then (Bfile uploading with Mac IE 5 worked fine. (BBut I don't know why. (B (B (B- (BTo unsubscribe, e-mail: [EMAIL PROTECTED] (BFor additional commands, e-mail: [EMAIL PROTECTED]
Re: File Upload size restriction ??
I submited a bug on bugzilla for this. I discovered that I get this strange freeze when generated HTML is *long*. As I use the validator, I restricted the generated javascript to the 3 functions we use on the webapp and it works. If I add some hundred of basic HTML at JSP end, if freeze. You should try to limit generated HTML size, until someone founds the problem (no idea for myself, neither reading the code nor using a debugger). Nico. I'm experiencing the EXACT same problem (Win2000, Struts 1.1 RC 1, Weblogic 7, Sun JDK 1.3.1_07). I've noticed that if my input forward is a simple JSP, it works fine. Also, it works fine if the input forward is a tile definition which simply specifies a JSP, like this: definition name=tile.struts.upload.upload path=/upload.jsp/ However, it hangs if I try to get fancy and use some inheritance in my definitions, like this: definition name=tile.struts.upload.upload extends=tile.main put name=window.title.key value=key.title.window.home/ put name=body.tile value=tile.struts.upload.upload.body/ /definition definition name=tile.struts.upload.upload.body extends=tile.main.body.internalTitle put name=title.key/ put name=content.tile value=/upload.jsp/ /definition It does eventually come back with the error message, but only after 5 - 10 minutes (and I see the second request just like Nico mentioned). If I switch to JRockit 1.3.1, it hangs forever (well, at least as long as lunch :-) Nicolas, have you or anyone else discovered a solution/workaround? Thanks! best, garthabrindoid Nicolas De Loof wrote: That's what I was trying to do and discovered that upload behaviour changes when going over Struts configured file-size limit (4Mo in my case). With a 3Mo file it works fine. With a 4,4Mo file I get errors on logs but upload goes on in the browser, and after a long while (3 minutes) I get others validate() logs (related with no-file errors) and the errors are displayed on browser. I don't understand why I get TWO TIMES validate() logs !! If i set the size-limit to 6M, 4,4Mo upload works well in less than a seconds, but a 10Mo upload takes more than 5 minutes. I get file-size error logs in the first request seconds, browser stays for a (long) while and I get second validation error logs. Using IP or machine name doesn't change anything. Nico. __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - 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]
Re: File Upload size restriction ??
I'm experiencing the EXACT same problem (Win2000, Struts 1.1 RC 1, Weblogic 7, Sun JDK 1.3.1_07). I've noticed that if my input forward is a simple JSP, it works fine. Also, it works fine if the input forward is a tile definition which simply specifies a JSP, like this: definition name=tile.struts.upload.upload path=/upload.jsp/ However, it hangs if I try to get fancy and use some inheritance in my definitions, like this: definition name=tile.struts.upload.upload extends=tile.main put name=window.title.key value=key.title.window.home/ put name=body.tile value=tile.struts.upload.upload.body/ /definition definition name=tile.struts.upload.upload.body extends=tile.main.body.internalTitle put name=title.key/ put name=content.tile value=/upload.jsp/ /definition It does eventually come back with the error message, but only after 5 - 10 minutes (and I see the second request just like Nico mentioned). If I switch to JRockit 1.3.1, it hangs forever (well, at least as long as lunch :-) Nicolas, have you or anyone else discovered a solution/workaround? Thanks! best, garthabrindoid Nicolas De Loof wrote: That's what I was trying to do and discovered that upload behaviour changes when going over Struts configured file-size limit (4Mo in my case). With a 3Mo file it works fine. With a 4,4Mo file I get errors on logs but upload goes on in the browser, and after a long while (3 minutes) I get others validate() logs (related with no-file errors) and the errors are displayed on browser. I don't understand why I get TWO TIMES validate() logs !! If i set the size-limit to 6M, 4,4Mo upload works well in less than a seconds, but a 10Mo upload takes more than 5 minutes. I get file-size error logs in the first request seconds, browser stays for a (long) while and I get second validation error logs. Using IP or machine name doesn't change anything. Nico. __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File Upload size restriction ?? IT DOESN'T WORK ON STRUTS-EXAMPLE
I made some test on another Win2k PC with tomcat 4.1.24 I get the same browser waiting bug with *long* JSP on this config. I can send a modified struts-upload.war file (1Mo) if you want to test (upload.jsp changed to add 900 HTML lines) Nico Making lot of tests, it seems that my problem does occur if the generated HTML is long. I made this test on struts-upload example webapp : install struts-upload.war edit /upload.jsp to add long text (I use struts-validator javascript : 730 lines ) try to upload a 2Mo file - jsp is compiled shortly after file submit - browser wait for long time before displaying error messsage Could someone please make this test on his config ? I'm not sure this troubles doesn't come from my environment (tomcat 4.1.24 - eclipse - win2k - IE 6sp1). Nico. - Original Message - From: Nicolas De Loof [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, June 30, 2003 3:43 PM Subject: Re: File Upload size restriction ?? [TilesRequestProcessor ?] I'm back with my FileUpload problem ... Here is what I've done to search the problem : I added struts-upload example classes and mappings to my app : it works I migrate it to use my classes (form-bean, actions) : it works I migrate it to use my JSPs : it works I migrate it to use my Tiles definition : it fails (browser waits 10 minutes...) Her is my mapping : action path=/upload name=UploadForm scope=request input=select validate=true type=webapp.action.UploadAction forward name=select path=tiles:upload.select / forward name=success path=tiles:upload.done / /action If I replace tiles:upload.select by /upload.jsp (that is used in body of this tile) it works fine : I get quickly an error saying file is too large. Any idea what I can do to go deeper in my bug tracking ? Nico. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File Upload size restriction ??
Uups, found the answer in one of the strus-examples. Here it is for those who are interested. Regards Markus /** * Check to make sure the client hasn't exceeded the maximum allowed upload size inside of this * validate method. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = null; //has the maximum length been exceeded? Boolean maxLengthExceeded = (Boolean) request.getAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED); if ((maxLengthExceeded != null) (maxLengthExceeded.booleanValue())) { errors = new ActionErrors(); errors.add(ERROR_PROPERTY_MAX_LENGTH_EXCEEDED, new ActionError(maxLengthExceeded)); } return errors; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File Upload size restriction ??
I'm using fileupload too and have difficulties to send errors about file size. Are you able to send an error message with this code ? In my application validate method returns errors (I can see it in logs) when file is too large, but browser does'nt display error JSP (waintg ...). I thing it is waiting for the file to be uploaded or something like this. I'm using tomcat 4.1.24 an IE 6 on Windows 2000. Nico. Uups, found the answer in one of the strus-examples. Here it is for those who are interested. Regards Markus /** * Check to make sure the client hasn't exceeded the maximum allowed upload size inside of this * validate method. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = null; //has the maximum length been exceeded? Boolean maxLengthExceeded = (Boolean) request.getAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED); if ((maxLengthExceeded != null) (maxLengthExceeded.booleanValue())) { errors = new ActionErrors(); errors.add(ERROR_PROPERTY_MAX_LENGTH_EXCEEDED, new ActionError(maxLengthExceeded)); } return errors; } - 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]
Re: File Upload size restriction ??
In fact I've got this strange behaviour : - Form-bean is validated a first time. MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED is setted and an ActionError is returned by validate(). - browser go on uploading for a long time ... (5 minutes for 10Mo upload on localhost) - validate is called A SECOND TIME. MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED is setted and an ActionError is returned by validate(). - browser show errors. My code looks like Struts upload example. I certainly not understood something ! Nico. I'm using fileupload too and have difficulties to send errors about file size. Are you able to send an error message with this code ? In my application validate method returns errors (I can see it in logs) when file is too large, but browser does'nt display error JSP (waintg ...). I thing it is waiting for the file to be uploaded or something like this. I'm using tomcat 4.1.24 an IE 6 on Windows 2000. Nico. Uups, found the answer in one of the strus-examples. Here it is for those who are interested. Regards Markus /** * Check to make sure the client hasn't exceeded the maximum allowed upload size inside of this * validate method. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = null; //has the maximum length been exceeded? Boolean maxLengthExceeded = (Boolean) request.getAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED); if ((maxLengthExceeded != null) (maxLengthExceeded.booleanValue())) { errors = new ActionErrors(); errors.add(ERROR_PROPERTY_MAX_LENGTH_EXCEEDED, new ActionError(maxLengthExceeded)); } return errors; } - 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]
Re: File Upload size restriction ??
Nicolas De Loof rta: - browser go on uploading for a long time ... (5 minutes for 10Mo upload on localhost) Thou this is not your main problem, I'd like to add a bit: I experienced similar behaviour w/ IE and found that changing the URL from http://localhost:8080/myontext to http://my.real.ip.address:8080/mycontext solved the slow upload problem. Tib - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File Upload size restriction ??
Try this API. http://www.servlets.com/cos/index.html .V Nicolas De Loof wrote: In fact I've got this strange behaviour : - Form-bean is validated a first time. MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED is setted and an ActionError is returned by validate(). - browser go on uploading for a long time ... (5 minutes for 10Mo upload on localhost) - validate is called A SECOND TIME. MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED is setted and an ActionError is returned by validate(). - browser show errors. My code looks like Struts upload example. I certainly not understood something ! Nico. I'm using fileupload too and have difficulties to send errors about file size. Are you able to send an error message with this code ? In my application validate method returns errors (I can see it in logs) when file is too large, but browser does'nt display error JSP (waintg ...). I thing it is waiting for the file to be uploaded or something like this. I'm using tomcat 4.1.24 an IE 6 on Windows 2000. Nico. Uups, found the answer in one of the strus-examples. Here it is for those who are interested. Regards Markus /** * Check to make sure the client hasn't exceeded the maximum allowed upload size inside of this * validate method. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = null; //has the maximum length been exceeded? Boolean maxLengthExceeded = (Boolean) request.getAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED); if ((maxLengthExceeded != null) (maxLengthExceeded.booleanValue())) { errors = new ActionErrors(); errors.add(ERROR_PROPERTY_MAX_LENGTH_EXCEEDED, new ActionError(maxLengthExceeded)); } return errors; } - 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] -- Vic Cekvenich, Struts Instructor, 1-800-917-JAVA Advanced a href =baseBeans.comStruts Training/a and project recovery in North East. Open Source a href =baseBeans.comContent Management/a basicPortal sofware Best practicea href =baseBeans.comStruts Support/a v.1.1 helper ScafflodingXPress - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File Upload size restriction ??--another question--urgent
Prashanth.S wrote: Hi all, Is there any limit on the size of the file to be uploaded when i use struts... Iam using FormFile interface for struts upload... Is there any limit on the size of the file that is being uploaded...Iam getting error when i am uploading large files even though iam not using any validations... Waiting for reply Thanking you Prashanth Don't know about the TomCat capacity with file-uploads, but you must define the upload-buffer size within the controler Tag in your struts-config XML. The Struts docu says: 'maxFileSize - The maximum size (in bytes) of a file to be accepted as a file upload. Can be expressed as a number followed by a K, M, or G, which are interpreted to mean kilobytes, megabytes, or gigabytes, respectively. [250M] (optional)' So if not set, the upload should be limited to 250 MBytes. Regards Markus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File Upload size restriction ??
Nicolas De Loof wrote: In fact I've got this strange behaviour : - Form-bean is validated a first time. MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED is setted and an ActionError is returned by validate(). - browser go on uploading for a long time ... (5 minutes for 10Mo upload on localhost) - validate is called A SECOND TIME. MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED is setted and an ActionError is returned by validate(). - browser show errors. My code looks like Struts upload example. I certainly not understood something ! Nico. Tried a 135 MBytes upload on localhost. Took 10 sec to complete and the returned JSP-paged showed the correct error in the browser. Maybe you should check first, why the uploads takes so long on your machine. Regards Markus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File Upload size restriction ??
I Tried Struts upload example App and it works fine. So browser or tomcat conf are not responsible. Do you have any idea what I can look at to discover what works wrong on my app ? Nico. Nicolas De Loof wrote: In fact I've got this strange behaviour : - Form-bean is validated a first time. MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED is setted and an ActionError is returned by validate(). - browser go on uploading for a long time ... (5 minutes for 10Mo upload on localhost) - validate is called A SECOND TIME. MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED is setted and an ActionError is returned by validate(). - browser show errors. My code looks like Struts upload example. I certainly not understood something ! Nico. Tried a 135 MBytes upload on localhost. Took 10 sec to complete and the returned JSP-paged showed the correct error in the browser. Maybe you should check first, why the uploads takes so long on your machine. Regards Markus - 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]
Re: File Upload size restriction ??
That's what I was trying to do and discovered that upload behaviour changes when going over Struts configured file-size limit (4Mo in my case) With a 3Mo file it works fine. With a 4,4Mo file I get errors on logs but upload goes on in the browser, and after a long while (3 minutes) I get others validate() logs (related with no-file errors) and the errors are displayed on browser. I don't understand why I get TWO TIMES validate() logs !! If i set the size-limit to 6M, 4,4Mo upload works well in less than a seconds, but a 10Mo upload takes more than 5 minutes. I get file-size error logs in the first request seconds, browser stays for a (long) while and I get second validation error logs. Using IP or machine name doesn't change anything. Nico. Tried a 135 MBytes upload on localhost. Took 10 sec to complete and the returned JSP-paged showed the correct error in the browser. Maybe you should check first, why the uploads takes so long on your machine. Regards Markus - 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]
Re: File Upload size restriction ??
Nicolas De Loof wrote: That's what I was trying to do and discovered that upload behaviour changes when going over Struts configured file-size limit (4Mo in my case) With a 3Mo file it works fine. With a 4,4Mo file I get errors on logs but upload goes on in the browser, and after a long while (3 minutes) I get others validate() logs (related with no-file errors) and the errors are displayed on browser. I don't understand why I get TWO TIMES validate() logs !! If i set the size-limit to 6M, 4,4Mo upload works well in less than a seconds, but a 10Mo upload takes more than 5 minutes. I get file-size error logs in the first request seconds, browser stays for a (long) while and I get second validation error logs. Using IP or machine name doesn't change anything. Nico. Had some mysterious browser-waits too. That had nothing to do with file-uploads in my case, but with some mapping-configuration in the struts-config.xml. I finally got a work around when forwarding from an Action-Servlet direct to a jsp-page and not through any ActionMapping. Never figured out the real problem after I find the workaround. Did you try the struts-example with an upload-limit ? If this works without problem too, maybe you should play around with some different forward mappings... regards Markus Maybe you - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File Upload size restriction ?? [TilesRequestProcessor ?]
I'm back with my FileUpload problem ... Here is what I've done to search the problem : I added struts-upload example classes and mappings to my app : it works I migrate it to use my classes (form-bean, actions) : it works I migrate it to use my JSPs : it works I migrate it to use my Tiles definition : it fails (browser waits 10 minutes...) Her is my mapping : action path=/upload name=UploadForm scope=request input=select validate=true type=webapp.action.UploadAction forward name=select path=tiles:upload.select / forward name=success path=tiles:upload.done / /action If I replace tiles:upload.select by /upload.jsp (that is used in body of this tile) it works fine : I get quickly an error saying file is too large. Any idea what I can do to go deeper in my bug tracking ? Nico. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File Upload size restriction ?? IT DOESN'T WORK ON STRUTS-EXAMPLE
Making lot of tests, it seems that my problem does occur if the generated HTML is long. I made this test on struts-upload example webapp : install struts-upload.war edit /upload.jsp to add long text (I use struts-validator javascript : 730 lines ) try to upload a 2Mo file - jsp is compiled shortly after file submit - browser wait for long time before displaying error messsage Could someone please make this test on his config ? I'm not sure this troubles doesn't come from my environment (tomcat 4.1.24 - eclipse - win2k - IE 6sp1). Nico. - Original Message - From: Nicolas De Loof [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, June 30, 2003 3:43 PM Subject: Re: File Upload size restriction ?? [TilesRequestProcessor ?] I'm back with my FileUpload problem ... Here is what I've done to search the problem : I added struts-upload example classes and mappings to my app : it works I migrate it to use my classes (form-bean, actions) : it works I migrate it to use my JSPs : it works I migrate it to use my Tiles definition : it fails (browser waits 10 minutes...) Her is my mapping : action path=/upload name=UploadForm scope=request input=select validate=true type=webapp.action.UploadAction forward name=select path=tiles:upload.select / forward name=success path=tiles:upload.done / /action If I replace tiles:upload.select by /upload.jsp (that is used in body of this tile) it works fine : I get quickly an error saying file is too large. Any idea what I can do to go deeper in my bug tracking ? Nico. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: file upload and unicode
Dzidorius Martinaitis (kafka) rta: Hello, I try use filter, but always get this error: 09:38:52,076 ERROR [Digester] Parse Error at line 65 column -1: Element web-app does not allow filter here. org.xml.sax.SAXParseException: Element web-app does not allow filter here. at org.apache.crimson.parser.Parser2.error(Parser2.java:3160) My server is Tomcat 4.1.12 Chck your dtd. It should be !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; The web-app_2_2 does not allow filters. Hth, Tib - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: file upload and unicode
Yes, I know. And my web.xml have exactly this declaration. But problem is same. Chck your dtd. It should be !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; The web-app_2_2 does not allow filters. Hth, Tib - 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]
Re: file upload and unicode
Dzidorius Martinaitis (kafka) rta: Yes, I know. And my web.xml have exactly this declaration. But problem is same. And the order of tags are preserved according to this DTD? Some containers require this as well others not. !ELEMENT web-app (icon?, display-name?, description?, distributable?, context-param*, filter*, filter-mapping*, listener*, servlet*, servlet-mapping*, session-config?, mime-mapping*, welcome-file-list?, error-page*, taglib*, resource-env-ref*, resource-ref*, security-constraint*, login-config?, security-role*, env-entry*, ejb-ref*, ejb-local-ref*) Tib - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: file upload and unicode
part of web.xml: ?xml version=1.0? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app filter filter-nameSet Character Encoding/filter-name filter-classfilters.SetCharacterEncodingFilter/filter-class init-param param-nameencoding/param-name param-valueUTF-8/param-value /init-param /filter filter-mapping filter-nameSet Character Encoding/filter-name servlet-nameaction/servlet-name /filter-mapping !-- Standard Action Servlet Configuration (with debugging) -- servlet skip Yes, I know. And my web.xml have exactly this declaration. But problem is same. And the order of tags are preserved according to this DTD? Some containers require this as well others not. !ELEMENT web-app (icon?, display-name?, description?, distributable?, context-param*, filter*, filter-mapping*, listener*, servlet*, servlet-mapping*, session-config?, mime-mapping*, welcome-file-list?, error-page*, taglib*, resource-env-ref*, resource-ref*, security-constraint*, login-config?, security-role*, env-entry*, ejb-ref*, ejb-local-ref*) Tib - 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]
Re: file upload and unicode
Dzidorius Martinaitis (kafka) rta: Hello, I try use filter, but always get this error: 09:38:52,076 ERROR [Digester] Parse Error at line 65 column -1: Element What is on 65th line of your web.xml? Tib - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: file upload and unicode
Sorry, you was right. I lift filter declaration above all and have good depoyment. And now I have unicode and file upload. Thank you very much. Hello, I try use filter, but always get this error: 09:38:52,076 ERROR [Digester] Parse Error at line 65 column -1: Element What is on 65th line of your web.xml? Tib - 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]
Re: file upload and unicode
Just upload the file as normal binary file. When you read this file at the server side, make sure to read it with correct encoding of unicode type (like UTF8,UTF16, etc) You probably need to allow the user to enter the upload file encoding type, and pass along this info to server -Dan - Original Message - From: Dzidorius Martinaitis (kafka) [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, June 22, 2003 11:46 PM Subject: file upload and unicode Hello, I try use filter, but always get this error: 09:38:52,076 ERROR [Digester] Parse Error at line 65 column -1: Element web-app does not allow filter here. org.xml.sax.SAXParseException: Element web-app does not allow filter here. at org.apache.crimson.parser.Parser2.error(Parser2.java:3160) My server is Tomcat 4.1.12 I want add filter from: http://www.anassina.com/struts/i18n/i18n.html I have problem with file upload and unicode and will hope that this solve my problem. Now I use my RequestProcessor, but it not solve problem with file upload and unicode. This code I use in RequestProcessor: try { request.setCharacterEncoding(UTF-8) ; } catch(java.io.UnsupportedEncodingException e) { System.out.println(e); } Could I hope, what filter will solve my problem with file upload and unicode and why I get this error? - 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]
Re: File upload question yet again
Alen Ribic wrote: What I whish to avoid is that a file does not get loaded as a property each time the value object is needed but only when a image viewing is required. (e.g. a view image link is clicked in manager role view) Store a reference to the file (perhaps a String pathname) rather than the File itself as a property. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File upload (multipart forms) on WebSphere. Can or not?
Sorry, I can't give you much insight to your exception, but I *can* say that File upload works. I am using File upload on both WAS 5.0 and 4.0. Off the top of my head, I can't think of anything special I had do to make it work. Susan Bradeen On 04/04/2003 12:39:07 AM Andrew Hill wrote: My colleague is trying to make our application run on WebSphere (WAS 5.0), however we are encountering an error submitting multipart forms. (Stacktrace pasted below) (Needless to say it all works sweet on TomCat...) Ive not had time to experiment with it myself, but it looks like WAS is barfing on the org.apache.struts.upload.MultipartRequestWrapper object that struts wraps multipart requests in so one can get at the parameters. This implements HttpServletRequest but doesnt extend javax.servlet.http.HttpServletRequestWrapper in order to maintain compatibility with Servlet2.2 Is it a requirement in WAS or the Servlet specs that all HttpServletRequest implementations extend this? (And why would it cause a problem? I thought the struts wrapper is ditched before forwarding anyway?) [4/4/03 11:18:13:734 GMT+08:00] 691323f4 I UOW= source=com.gridnode.gtas.client.web.strutsbase.GTRequestProcessor class=com.gridnode.gtas.client.web.strutsbase.GTRequestProcessor method= org=IBM prod=WebSphere component=UNKNOWN Processing a 'POST' for path '/sysFoldersDispatchAction' [4/4/03 11:18:13:795 GMT+08:00] 691323f4 I UOW= source=com.gridnode.gtas.client.web.strutsbase.GTRequestProcessor class=com.gridnode.gtas.client.web.strutsbase.GTRequestProcessor method= org=IBM prod=WebSphere component=UNKNOWN Looking for ActionForm in OperationContext id=oc1 [4/4/03 11:18:13:795 GMT+08:00] 691323f4 I UOW= source=com.gridnode.gtas.client.web.strutsbase.GTRequestProcessor class=com.gridnode.gtas.client.web.strutsbase.GTRequestProcessor method= org=IBM prod=WebSphere component=UNKNOWN Found ActionForm in OperationContext [4/4/03 11:18:14:305 GMT+08:00] 691323f4 O UOW= source=SystemOut org=IBM prod=WebSphere component=Application Server { [4/4/03 11:18:14:305 GMT+08:00] 691323f4 I UOW= source=com.gridnode.gtas.client.web.strutsbase.GTRequestProcessor class=com.gridnode.gtas.client.web.strutsbase.GTRequestProcessor method= org=IBM prod=WebSphere component=UNKNOWN Processing a 'POST' for path '/renderingAction' [4/4/03 11:18:16:458 GMT+08:00] 691323f4 E UOW= source=com.ibm.ws.webcontainer.srt.WebGroup org=IBM prod=WebSphere component=Application Server SRVE0026E: [Servlet Error]-[action]: java.lang.IllegalArgumentException: Request is not of javax.servlet.ServletRequestWrapper type at com.ibm.ws.webcontainer.webapp.WebAppDispatcherRequest.getWASProxiedHttpServletR equest(WebAppDispatcherRequest.java:155) at com.ibm.ws.webcontainer.webapp.WebAppDispatcherRequest.getSession(WebAppDispatch erRequest.java:234) at com.ibm.ws.webcontainer.webapp.WebAppDispatcherRequest.getSession(WebAppDispatch erRequest.java:219) at org.apache.struts.upload.MultipartRequestWrapper.getSession(MultipartRequestWrap per.java:242) at com.gridnode.gtas.client.web.strutsbase.GTRequestProcessor.processLocale(GTReque stProcessor.java:167) at com.gridnode.gtas.client.web.strutsbase.GTRequestProcessor.process(GTRequestProc essor.java:250) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1109) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:470) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletIns tance.java:110) at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleS ervlet.java:174) at com.ibm.ws.webcontainer.servlet.ServicingServletState.service(StrictLifecycleSer vlet.java:333) at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleSe rvlet.java:116) at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:258 ) at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServlet ReferenceState.java:42) at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanc eReference.java:40) at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebA ppRequestDispatcher.java:867) at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDis patcher.java:491) at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDisp atcher.java:173) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:972) at org.apache.struts.action.RequestProcessor.processActionForward(RequestProcessor. java:408) at com.gridnode.gtas.client.web.strutsbase.GTRequestProcessor.process(GTRequestProc essor.java:299) at
Re: File Upload with Invalid or Missing File Name
See the thread I started Problem with empty file upload field. I found mozilla was the problem. I was running 0.99 and upgrading fixed the problem. Let me know how it goes for you... Jörg Maurer wrote: Have you downloaded source or binary? Try like myself source und recompile YS?!?! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Montag, 10. Februar 2003 20:00 To: [EMAIL PROTECTED] Subject: File Upload with Invalid or Missing File Name Here is what I did: 1. Downloaded Tomcat 4.1.18 and installed. 2. Downloaded Struts 1.1B3 and copied struts-upload.war to the webapps directory of my Tomcat install from step 1. 3. Set my JAVA_HOME environment variable to point to the location of my 1.3 Java (1.3.1_04). 4. Started Tomcat so that struts-upload is deployed. 5. From Mozilla, accessed http://localhost:8080/struts-upload;. 6. The file upload screen displays properly and if I browse to a legitimate file and press submit, then the file is uploaded without error. However, if I leave the file name empty or enter an invalid file name, then I get the error shown below: Others on this list have apparently had success with empty file names. So I am very confused as to why I still see the populate error. I have tried Struts 1.1B2 and Struts 1.1B3 and JDK 1.4.1 as well as 1.3.1 as well as earlier versions of Tomcat. All attempts with a blank file name lead to the same error. I have exhausted everything that I can try, so help would be greatly appreciated. Cynthia Jeness java.lang.IllegalArgumentException: argument type mismatch at java.lang.reflect.Method.invoke(Native Method) at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUti ls.java:1789) at org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUti ls.java:1684) at org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.jav a:1713) at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:924) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:729) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1097) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcess or.java:798) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java: 254) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv e.java:260) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv e.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241 5) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java :180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa lve.java:170) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java :172) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. java:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:43 2) at
RE: File Upload with Invalid or Missing File Name
Have you downloaded source or binary? Try like myself source und recompile YS?!?! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Montag, 10. Februar 2003 20:00 To: [EMAIL PROTECTED] Subject: File Upload with Invalid or Missing File Name Here is what I did: 1. Downloaded Tomcat 4.1.18 and installed. 2. Downloaded Struts 1.1B3 and copied struts-upload.war to the webapps directory of my Tomcat install from step 1. 3. Set my JAVA_HOME environment variable to point to the location of my 1.3 Java (1.3.1_04). 4. Started Tomcat so that struts-upload is deployed. 5. From Mozilla, accessed http://localhost:8080/struts-upload;. 6. The file upload screen displays properly and if I browse to a legitimate file and press submit, then the file is uploaded without error. However, if I leave the file name empty or enter an invalid file name, then I get the error shown below: Others on this list have apparently had success with empty file names. So I am very confused as to why I still see the populate error. I have tried Struts 1.1B2 and Struts 1.1B3 and JDK 1.4.1 as well as 1.3.1 as well as earlier versions of Tomcat. All attempts with a blank file name lead to the same error. I have exhausted everything that I can try, so help would be greatly appreciated. Cynthia Jeness java.lang.IllegalArgumentException: argument type mismatch at java.lang.reflect.Method.invoke(Native Method) at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUti ls.java:1789) at org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUti ls.java:1684) at org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.jav a:1713) at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:924) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:729) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1097) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcess or.java:798) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java: 254) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv e.java:260) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv e.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241 5) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java :180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa lve.java:170) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java :172) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. java:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223) at
Re: file upload + WebSphere 4.0 - IOException while reading file element
David, This *may* be a WebSphere issue. We were working on a non-Struts web app over this past Summer in which we had problems uploading large files (anything over 15K, I think). I believe we resorted to using a program one of our iSeries developers created as our work-around for uploading larger files. Susan Bradeen Purcell, Dave [EMAIL PROTECTED] 11/14/2002 10:36 AM Please respond to Struts Users Mailing List To: [EMAIL PROTECTED] cc: Subject:file upload + WebSphere 4.0 - IOException while reading file element I apologize if this is answered elsewhere in the list. I couldn't find a similar entry. I am using WebSphere 4.0 with Struts 1.0.2. I am trying to upload files (multiple files per request) and am having problems. Very small files seem to work fine (10k). However, large files (50k) fail - before it reaches any code in my Action class. The following are the messages that are thrown in the servlet log. [Servlet LOG]: action: Populating bean properties from this request Servlet Error: IOException while reading file element: Premature end of stream while reading multipart request: java.io.IOException: Premature end of stream while reading multipart request Is there a known defect that is causing this problem, or a setting that I have missed? If file upload isn't working in this configuration, is there a known work-around where I could implement my own DiskMultipartRequestHandler and simply avoid the File elements, and use another approach to handle the uploaded files (such as Marsh?). Any help would be appreciated. Thanks. David Purcell [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: file upload + WebSphere 4.0 - IOException while reading fileelement
On Thu, 14 Nov 2002, Purcell, Dave wrote: I apologize if this is answered elsewhere in the list. I couldn't find a similar entry. I am using WebSphere 4.0 with Struts 1.0.2. I am trying to upload files (multiple files per request) and am having problems. Very small files seem to work fine (10k). However, large files (50k) fail - before it reaches any code in my Action class. The following are the messages that are thrown in the servlet log. There are a number of known issues with file uploads in Struts 1.0.x. Struts 1.1 includes an entirely new file upload implementation, based on the Jakarta Commons FileUpload component. This implementation is much more robust, and should resolve any issues you are seeing. -- Martin Cooper [Servlet LOG]: action: Populating bean properties from this request Servlet Error: IOException while reading file element: Premature end of stream while reading multipart request: java.io.IOException: Premature end of stream while reading multipart request Is there a known defect that is causing this problem, or a setting that I have missed? If file upload isn't working in this configuration, is there a known work-around where I could implement my own DiskMultipartRequestHandler and simply avoid the File elements, and use another approach to handle the uploaded files (such as Marsh?). Any help would be appreciated. Thanks. David Purcell [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: File Upload : Progress Bar
2002. november 12. 14:22 dátummal [EMAIL PROTECTED] ezt írtad: Hi, I was just experimenting with the file-upload utility of Struts, and it works fine. For one of my projects I need to upload rather big files, which take a long time. I was thinking about implementing some kind of progress bar where the user can view what the status of his upload is. Sorry but his sounds impossible The upload is done by your browser, and you have no interaction with the client until it sends the full request. And in this case the file is the part of the request, so it must be uploaded and then will you be able to do any action. Hth, Tib -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: File Upload : Progress Bar
I have seen this done, from what I can remember you'll need to created a jsp that polls an upload thread, which determines the current-size of the upload. You know the total size of the upload. ..sorry I can't be more specific - Original Message - From: [EMAIL PROTECTED] To: struts [EMAIL PROTECTED] Sent: Tuesday, November 12, 2002 2:22 PM Subject: File Upload : Progress Bar Hi, I was just experimenting with the file-upload utility of Struts, and it works fine. For one of my projects I need to upload rather big files, which take a long time. I was thinking about implementing some kind of progress bar where the user can view what the status of his upload is. The server first copies the file to a temporary folder before you can access it (and this first copy takes most of the time). Then I can use an InputStream to copy the folder to the correct place (and make that loader), but it's just on copying from one location on the server to another. What I need is a loader for copying from the client to the server. Creating the loader is not the problem, but getting the percentage done is... Has anyone done this? Or is it not possible? thanks in advance... Jeroen Keppens -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: File Upload : Progress Bar
2002. november 12. 14:39 dátummal Mark Ayad ezt írtad: I have seen this done, from what I can remember you'll need to created a jsp that polls an upload thread, which determines the current-size of the upload. You know the total size of the upload. ..sorry I can't be more specific Umm... thats sounds as a good idea: the submit pops up a window, the window itself refreshes itself time to time, and the server responds with the progress... Hmm... Sorry for misleading you in my previous mail. Tib -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: File Upload : Progress Bar
I've seen it done too, but not in JSP/Servlets (in my asp days... brrr) Going to try it... -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: File Upload : Progress Bar
Keep us posted. If you run into some difficulties, I would be willing to jump in with some assistance, if I have some. You can contact me at [EMAIL PROTECTED] At 02:45 PM 11/12/2002 +0100, you wrote: I've seen it done too, but not in JSP/Servlets (in my asp days... brrr) Going to try it... -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org Micael --- This electronic mail transmission and any accompanying documents contain information belonging to the sender which may be confidential and legally privileged. This information is intended only for the use of the individual or entity to whom this electronic mail transmission was sent as indicated above. If you are not the intended recipient, any disclosure, copying, distribution, or action taken in reliance on the contents of the information contained in this transmission is strictly prohibited. If you have received this transmission in error, please delete the message. Thank you -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: File Upload : Progress Bar
I have the code for this someplace, but It would take me an age to find it. Mark - Original Message - From: micael [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, November 12, 2002 7:20 PM Subject: Re: File Upload : Progress Bar Keep us posted. If you run into some difficulties, I would be willing to jump in with some assistance, if I have some. You can contact me at [EMAIL PROTECTED] At 02:45 PM 11/12/2002 +0100, you wrote: I've seen it done too, but not in JSP/Servlets (in my asp days... brrr) Going to try it... -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org Micael --- This electronic mail transmission and any accompanying documents contain information belonging to the sender which may be confidential and legally privileged. This information is intended only for the use of the individual or entity to whom this electronic mail transmission was sent as indicated above. If you are not the intended recipient, any disclosure, copying, distribution, or action taken in reliance on the contents of the information contained in this transmission is strictly prohibited. If you have received this transmission in error, please delete the message. Thank you -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: File Upload : Progress Bar
You might just want to use a small applet(I believe the graphics code is already out there somewhere) and set up a servlet or jsp to check the file size against the Content-Length of the multipart POST (this may be a little off) and return the percentage to the applet so it can move the progress bar accordingly. - Original Message - From: [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, November 12, 2002 8:45 AM Subject: Re: File Upload : Progress Bar I've seen it done too, but not in JSP/Servlets (in my asp days... brrr) Going to try it... -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: File Upload Tutorial
download the struts binary and deploy the struts-upload.war, it will have explanations and source code available. Or, even just unzip the struts-upload.war to look at the source. - Original Message - From: Brandon Chee [EMAIL PROTECTED] To: struts-user [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 5:21 PM Subject: File Upload Tutorial Dear Sir/Madam, Can anyone point me to a good tutorial about file upload using Struts 1.1? Thanks a lot. Have a nice day. Best regards, Brandon -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
RE: file upload problem
Hello Mark, Before upgrading my struts to beta 2, I was using DiskFile class in my form bean to store the uploaded file. After an upgrade to beta 2, the DiskFile class throws your exception. If you use a DiskFile class to, my solution is to used instead a FormFile class to store uploaded file. Nicolas -Original Message- From: Mark Silva [mailto:[EMAIL PROTECTED]] Sent: vendredi 20 septembre 2002 21:41 To: Struts Users Mailing List Subject: file upload problem hello again, so i am trying to implement a file upload feature in my application, and i think i have everything setup correctly, but i am getting this error on submission. javax.servlet.ServletException: BeanUtils.populate java.lang.IllegalArgumentException: argument type mismatch i feel that this might be due to the type of the file field in the Form object. right now it is string (as is everything else). should the file type is a form object be something different? thanks, mark -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] attachment: winmail.dat -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: file upload problem
look at the file upload example that if I am not mistaken comes with struts... tiago ps FormFile and dont forget to set the content type At 12:40 PM 9/20/2002 -0700, you wrote: hello again, so i am trying to implement a file upload feature in my application, and i think i have everything setup correctly, but i am getting this error on submission. javax.servlet.ServletException: BeanUtils.populate java.lang.IllegalArgumentException: argument type mismatch i feel that this might be due to the type of the file field in the Form object. right now it is string (as is everything else). should the file type is a form object be something different? thanks, mark -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: file upload problem
What version of Struts are you using? You should take a look at the sources for the struts-upload sample application that comes with Struts. That will give you a working example to refer to. -- Martin Cooper -Original Message- From: Mark Silva [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 12:41 PM To: Struts Users Mailing List Subject: file upload problem hello again, so i am trying to implement a file upload feature in my application, and i think i have everything setup correctly, but i am getting this error on submission. javax.servlet.ServletException: BeanUtils.populate java.lang.IllegalArgumentException: argument type mismatch i feel that this might be due to the type of the file field in the Form object. right now it is string (as is everything else). should the file type is a form object be something different? thanks, mark -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: file upload problem
It's really difficult to help without seeing your code. Are you using html:file property=key / in your html:form? I don't know anything about BeanUtils, but if it acts like java.util.Properties, the key and value are both strings. File uploads are of type multipart/form-data (see experimental RFC 1867) and you retrieve it in the servlet with public String MultipartRequest.getParameter( String key); See: Jason Hunter, Java Servlet Programming, 2d ed., pp 119ff. Mark -Original Message- From: Mark Silva [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 3:41 PM To: Struts Users Mailing List Subject: file upload problem hello again, so i am trying to implement a file upload feature in my application, and i think i have everything setup correctly, but i am getting this error on submission. javax.servlet.ServletException: BeanUtils.populate java.lang.IllegalArgumentException: argument type mismatch i feel that this might be due to the type of the file field in the Form object. right now it is string (as is everything else). should the file type is a form object be something different? thanks, mark -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: file upload problem
I am using version 1.0.2. i went and looked at the example, and found my answer, FileForm. now i have another question, that may be a silly one, but is there any reason I shouldn't turn the contents of the FileForm into a String, and then run StringTokenizer over it? This is a csv file, that i am importing into the database. thanks, mark -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 12:43 PM To: 'Struts Users Mailing List' Subject: RE: file upload problem What version of Struts are you using? You should take a look at the sources for the struts-upload sample application that comes with Struts. That will give you a working example to refer to. -- Martin Cooper -Original Message- From: Mark Silva [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 12:41 PM To: Struts Users Mailing List Subject: file upload problem hello again, so i am trying to implement a file upload feature in my application, and i think i have everything setup correctly, but i am getting this error on submission. javax.servlet.ServletException: BeanUtils.populate java.lang.IllegalArgumentException: argument type mismatch i feel that this might be due to the type of the file field in the Form object. right now it is string (as is everything else). should the file type is a form object be something different? thanks, mark -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: file upload problem
use the getInputStream method... and do was you would with any inputstream i hate the IO classes, so good luck :) At 01:28 PM 9/20/2002 -0700, you wrote: I am using version 1.0.2. i went and looked at the example, and found my answer, FileForm. now i have another question, that may be a silly one, but is there any reason I shouldn't turn the contents of the FileForm into a String, and then run StringTokenizer over it? This is a csv file, that i am importing into the database. thanks, mark -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 12:43 PM To: 'Struts Users Mailing List' Subject: RE: file upload problem What version of Struts are you using? You should take a look at the sources for the struts-upload sample application that comes with Struts. That will give you a working example to refer to. -- Martin Cooper -Original Message- From: Mark Silva [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 12:41 PM To: Struts Users Mailing List Subject: file upload problem hello again, so i am trying to implement a file upload feature in my application, and i think i have everything setup correctly, but i am getting this error on submission. javax.servlet.ServletException: BeanUtils.populate java.lang.IllegalArgumentException: argument type mismatch i feel that this might be due to the type of the file field in the Form object. right now it is string (as is everything else). should the file type is a form object be something different? thanks, mark -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: file upload problem
-Original Message- From: Mark Silva [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 1:28 PM To: Struts Users Mailing List Subject: RE: file upload problem I am using version 1.0.2. I would strongly encourage you to move to Struts 1.1-b2 if you can. It uses a new file upload implementation which is faster and much more robust than the one in 1.0.2. No code changes are required on your part, since the interface is the same. i went and looked at the example, and found my answer, FileForm. You mean FormFile. ;-) now i have another question, that may be a silly one, but is there any reason I shouldn't turn the contents of the FileForm into a String, and then run StringTokenizer over it? This is a csv file, that i am importing into the database. You mean using getFileData()? That's OK as long as you are completely sure that the file is always going to be small. However, if you might ever have to process a large upload, then you should use getInputStream() to avoid running out of memory. Once you have the input stream, you can do whatever you like with it. Do remember to close it when you're done, though. -- Martin Cooper thanks, mark -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 12:43 PM To: 'Struts Users Mailing List' Subject: RE: file upload problem What version of Struts are you using? You should take a look at the sources for the struts-upload sample application that comes with Struts. That will give you a working example to refer to. -- Martin Cooper -Original Message- From: Mark Silva [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 12:41 PM To: Struts Users Mailing List Subject: file upload problem hello again, so i am trying to implement a file upload feature in my application, and i think i have everything setup correctly, but i am getting this error on submission. javax.servlet.ServletException: BeanUtils.populate java.lang.IllegalArgumentException: argument type mismatch i feel that this might be due to the type of the file field in the Form object. right now it is string (as is everything else). should the file type is a form object be something different? thanks, mark -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: File upload: no multipart request data sent
Does anyone have ANY ideas on this issue??? Im really in a bind here and could use any advice from anyone implementing the FileTag. Thanks again. Pete Serafin Pete Serafin wrote: I have a jsp used to do a simple file upload. I am retrieving and processing the file without any problems. However, when I try to forward to the same action ( or another action ) after the processing is done, I get the following error: javax.servlet.ServletException: MultipartIterator: no multipart request data sent at org.apache.struts.upload.MultipartIterator.parseRequest (MultipartIterator.java:342) When I forward to a JSP, I dont get this error. I am not doing any validation on this form, but I cant seem locate where the error is occuring. My form does have the following header: html:form action=updateCandidate.do enctype=multipart/form-data The error appears to be happing after the action forward, but before the perform method of the ensuing action. Any advise is greatly appreciated as I am completely stuck Pete Serafin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: File upload: no multipart request data sent
I assume you're using Struts 1.0.2 or earlier - you didn't say. I believe what you are seeing is a bug which is fixed in Struts 1.1-b1. -- Martin Cooper -Original Message- From: Pete Serafin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 24, 2002 7:28 AM To: '[EMAIL PROTECTED]' Subject: File upload: no multipart request data sent I have a jsp used to do a simple file upload. I am retrieving and processing the file without any problems. However, when I try to forward to the same action ( or another action ) after the processing is done, I get the following error: javax.servlet.ServletException: MultipartIterator: no multipart request data sent at org.apache.struts.upload.MultipartIterator.parseRequest (MultipartIterator.java:342) When I forward to a JSP, I dont get this error. I am not doing any validation on this form, but I cant seem locate where the error is occuring. My form does have the following header: html:form action=updateCandidate.do enctype=multipart/form-data The error appears to be happing after the action forward, but before the perform method of the ensuing action. Any advise is greatly appreciated as I am completely stuck Pete Serafin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: File upload: no multipart request data sent
try redirect=true in your forward -Original Message- From: Pete Serafin [mailto:[EMAIL PROTECTED]] Sent: Mittwoch, 24. Juli 2002 22:28 To: Struts Users Mailing List Subject: Re: File upload: no multipart request data sent Does anyone have ANY ideas on this issue??? Im really in a bind here and could use any advice from anyone implementing the FileTag. Thanks again. Pete Serafin Pete Serafin wrote: I have a jsp used to do a simple file upload. I am retrieving and processing the file without any problems. However, when I try to forward to the same action ( or another action ) after the processing is done, I get the following error: javax.servlet.ServletException: MultipartIterator: no multipart request data sent at org.apache.struts.upload.MultipartIterator.parseRequest (MultipartIterator.java:342) When I forward to a JSP, I dont get this error. I am not doing any validation on this form, but I cant seem locate where the error is occuring. My form does have the following header: html:form action=updateCandidate.do enctype=multipart/form-data The error appears to be happing after the action forward, but before the perform method of the ensuing action. Any advise is greatly appreciated as I am completely stuck Pete Serafin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: File upload Maximum limit
hi, this is Andy. i received below when i uploaded a file that size crosses 1MB: WebGroup X Servlet Error: IOException while reading file element: Premature end of stream while reading multipart request: java.io.IOException: Premature end of stream while reading multipart request at org.apache.struts.upload.MultipartIterator.createLocalFile(MultipartIterator .java:520) at org.apache.struts.upload.MultipartIterator.getNextElement(MultipartIterator. java:217) at org.apache.struts.upload.DiskMultipartRequestHandler.handleRequest(DiskMulti partRequestHandler.java:76) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:735) at org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:20 61) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1564) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager .java:827) at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycl eServlet.java:159) at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServle t.java:286) at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycle Servlet.java:106) at com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:47 2) at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletMan ager.java:1012) at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManag er.java:913) at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(W ebAppRequestDispatcher.java:499) at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequest Dispatcher.java:278) at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestD ispatcher.java:105) at com.ibm.servlet.engine.srt.WebAppInvoker.doForward(WebAppInvoker.java:67) at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker. java:123) at com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedIn vocation.java:67) at com.ibm.servlet.engine.invocation.CacheableInvocationContext.invoke(Cacheabl eInvocationContext.java:106) at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequ estProcessor.java:125) at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener .java:315) at com.ibm.servlet.engine.http11.HttpConnection.handleRequest(HttpConnection.ja va:60) at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:313) at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:242) at com.ibm.ws.util.CachedThread.run(ThreadPool.java:122) my envirement: Struts 1.0.2 (09-Feb-2002) IBM Websphere 4.0 AES Windows2000Prefressional thanks Andy.
RE: File upload Maximum limit
Our application is maxed out at 50mb, much beyond that, the server crashes. Jacob Hookom CS Student University of Wisconsin, Eau Claire === http://www.swanked.net you're not hip enough yet -Original Message- From: Gopalakrishnan Rangaswamy [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 10:04 AM To: [EMAIL PROTECTED] Subject: File upload Maximum limit Hi, Does struts limits the size of the file being uploaded. Because we are facing a problem when the file size crosses 1MB. I have searched mail archive, haven't found any reply in that. Regards, R.Gopalakrishnan --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.375 / Virus Database: 210 - Release Date: 7/10/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.375 / Virus Database: 210 - Release Date: 7/10/2002 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: File Upload/Download Issues
At 10:06 AM +0800 2002/06/18, Daniel J. D'Cotta wrote: So can someone answer my 3 questions (without suggesting Expresso)? 1. First, I have a concern for memory usage while uploading a huge (100+Mb) file. How does Struts handle uploading the file? Or is this purely a Web Server issue. Also, I am using the org.apache.struts.upload.FormFile class to read it. Does it matter if I use getInputStream() read batch-by-batch or getFileData()? Note that FormFile is an interface, not a class, so you could conceivably write a new implementation to address any performance issues. Most folks just use org.apache.struts.upload.DiskFile, which is the default. To customize, you would actually implement both MultipartRequestHandler and FormFile differently as necessary, because you plug these in by specifying a multipartClass property of your controller (in web.xml for Struts 1.0 and in the controller element of your struts-config in 1.1). The multipart handler is what creates objects of type FormFile to set those properties on your FormBean. The default implementation writes the file to disk, so memory shouldn't be a problem. I've found the form upload stuff to be extremely easy to implement, although I did it more by guesswork than from documentation. 2. Next, when I pre-set the value, it does not show in the input field. input type=file id=file name=file size=50 value=temp.txt/ I read somewhere that that is a html thing. Any way to get around it? Although value seems to be in the spec, I don't know of any browsers that pay any attention to values you put there. 3. Finally, How do you let users download a file with Struts? The file cannot be outside WEB-INF. (Could not find any documentation on this part, if you ask me to RTFM, please direct me to which part of the manual). You'd need to write directly to the HttpServletResponse object and return a null ActionMapping from the perform/execute method of your Action. You're responsible for setting all the headers (content type, etc). But this isn't hard to do -- it's just not something that Struts helps you do. Hope that helps, Joe -- -- * Joe Germuska{ [EMAIL PROTECTED] } It's pitiful, sometimes, if they've got it bad. Their eyes get glazed, they go white, their hands tremble As I watch them I often feel that a dope peddler is a gentleman compared with the man who sells records. --Sam Goody, 1956 tune in posse radio: http://www.live365.com/stations/289268 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: File Upload/Download Issues
PS: Anybody have examples that have file uploads/downloads? Uploads There's some sample code for file upload that was contributed at: http://www.jcorporate.com/product/expresso.html Documents link scroll down to Community Contributed Documents and click the Code for Browsing to File to Upload link. Alternatively go direct to: http://www.jcorporate.com/econtent/Content.do?state=resourceresource=780 Downloads --- There is also the code to download files within the open source Expresso project. You can see a demo of it onsite: http://www.jcorporate.com/product/expresso.html Demo link Security link then scroll down to download files and download definitions. We use this feature on the jcorporate site to define and make downloads available to our user community. In some cases we want to restrict downloads to certain user groups and this allows us to do that as well. It also enables us to track the number of downloads so that the community can gauge a project. Sandra -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: File upload failure in struts 1.1b - FIX
Probably a good idea to wait until the fix is done properly - I saw this fix in the mail archives and it seemed to fix our problems, but I also don't have the time to do all the appropriate multi-platform / multi-servlet standards tests... Regards, Don -Original Message- From: Jeremy Prellwitz [mailto:[EMAIL PROTECTED]] Sent: Monday, 27 May 2002 6:39 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: File upload failure in struts 1.1b - FIX Hey Don, My original problem was on Tomcat 4.04b3.because we are using WebSphere in production at work, i thought i'd better switch to Tomcat 3.x as WebSphere only supports up to servlet 2.2 and jsp 1.1. But the problem persists on Tomcat 3.x. As for the XML tag syntax, i did use the correct form. i included the compact form in my discussion to show the whole tag, but i was too lazy to fill in the middle html:file / tags and such. :) I've identified the code where the exception is being thrown from, but i don't have the time to thoroughly go through it (i.e. properly understand it)so i've just recommended to my co-worker that he use a separate web-app for his upload pages using Struts 1.0.2 as a work-around, until this issue is fixed in a stable release of 1.1. - Original Message - From: Don Elliott [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, May 24, 2002 5:43 PM Subject: RE: File upload failure in struts 1.1b - FIX Hi Jeremy, Did you have the original problem with multi-part forms on Tomcat 3 ? I wasn't sure if the problem occured on Tomcat 3.x as it looks like all the people reporting the problem are using a Servlet 2.3 implementation (3.x is Servlet 2.2). I'm not sure why this is the case, but I do know when we moved from 3.3 of Tomcat to 4.0 we had to replace a lot of calls to deprecated methods specifically to do with URL handling on the Servlet Request objects, so maybe it has something to do with this being restructured...(only a guess) re. your tag - ensure you don't have an end tag '/' on your form tag as this ends the form without the form actually starting - ie. html:form action= enctype=multipart/form-data/ will blow up - you need html:form action= enctype=multipart/form-data input fields, including html:file .../ /html:form On non-multipart forms having the / on the form tag usually gives you a wierd error message about field name 'xxx' cannot be found in org.apache.struts.action.BEAN or something equivalent - I'm not sure how this manifests itself in a multi-part form. Regards, Don -Original Message- From: Jeremy Prellwitz [mailto:[EMAIL PROTECTED]] Sent: Saturday, 25 May 2002 1:07 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: File upload failure in struts 1.1b - FIX I tried this patch with Tomcat 3.3.1, and all i did was add: enctype=multipart/form-data to the html:form / element, and then i got the following exceptions: javax.servlet.ServletException: Multipart data doesn't start with boundary at org.apache.struts.upload.DiskMultipartRequestHandler.handleReq uest(DiskMultipartRequestHandler.java:103) at org.apache.struts.util.RequestUtils.populate (RequestUtils.java:908) at org.apache.struts.action.RequestProcessor.processPopulate (RequestProcessor.java:795) at org.apache.struts.action.RequestProcessor.process (RequestProcessor.java:244) at org.apache.struts.action.ActionServlet.process (ActionServlet.java:1110) at org.apache.struts.action.ActionServlet.doPost (ActionServlet.java:470) at javax.servlet.http.HttpServlet.service (HttpServlet.java) at javax.servlet.http.HttpServlet.service (HttpServlet.java) at org.apache.tomcat.facade.ServletHandler.doService (ServletHandler.java:574) at org.apache.tomcat.core.Handler.invoke (Handler.java:322) at org.apache.tomcat.core.Handler.service (Handler.java:235) at org.apache.tomcat.facade.ServletHandler.service (ServletHandler.java:485) at org.apache.tomcat.facade.RequestDispatcherImpl.doForward (RequestDispatcherImpl.java:272) at org.apache.tomcat.facade.RequestDispatcherImpl.forward (RequestDispatcherImpl.java:174) at org.apache.struts.action.RequestProcessor.doForward (RequestProcessor.java:976) at org.apache.struts.action.RequestProcessor.processActionForward (RequestProcessor.java:408) at org.apache.struts.action.RequestProcessor.process (RequestProcessor.java:269) at org.apache.struts.action.ActionServlet.process (ActionServlet.java:1110) at org.apache.struts.action.ActionServlet.doPost (ActionServlet.java:470) at javax.servlet.http.HttpServlet.service (HttpServlet.java) at javax.servlet.http.HttpServlet.service (HttpServlet.java) at org.apache.tomcat.facade.ServletHandler.doService (ServletHandler.java:574) at org.apache.tomcat.core.Handler.invoke (Handler.java:322) at org.apache.tomcat.core.Handler.service (Handler.java:235
Re: File upload failure in struts 1.1b - FIX
One of the ways to get bugs assigned a higher priority is to vote for them in Bugzilla. I use Weblogic and file uploads, so I voted for this one. So far I think I'm the only one... http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8732 Joe At 11:19 AM +1000 5/24/02, Don Elliott wrote: Hi Struts Users / Developers, I've noticed a lot of posts about this in the archive, particularly with WebLogic 6.1 - we have also experienced the file upload crash in Servlet 2.3 on Tomcat 4.0.3 for Solaris The fix is as follows: In package org.apache.struts.action class RequestProcessor method doForward(...) add the follwing code as the first lines: if (request instanceof MultipartRequestWrapper) { request = ((MultipartRequestWrapper) request).getRequest(); } I've noticed that this doesn't have any priority in the fix list (are many people using this ?) - If anyone is interested I can send them a patched struts1.1b1.jar file or the RequestProcessor.class file until this fix is made in the nightlys.. (I'll batch up all requests for the .jar file daily to save my transfer costs). Regards, Don Elliott e. [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- -- * Joe Germuska{ [EMAIL PROTECTED] } It's pitiful, sometimes, if they've got it bad. Their eyes get glazed, they go white, their hands tremble As I watch them I often feel that a dope peddler is a gentleman compared with the man who sells records. --Sam Goody, 1956 tune in posse radio: http://www.live365.com/stations/289268 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]