File Upload error

2003-08-21 Thread Erez Efrati
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]



RE: File Upload error

2003-08-21 Thread Alex Shneyderman
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

2003-08-21 Thread Erez Efrati
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]



Upload Error

2003-06-26 Thread Flo
I applied the folowing example to my project but a get an error :

java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileUploadException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:1590)
at java.lang.Class.getConstructor0(Class.java:1762)
at java.lang.Class.newInstance0(Class.java:276)
at java.lang.Class.newInstance(Class.java:259)

http://jakarta.apache.org/struts/faqs/actionForm.html

[EMAIL PROTECTED] language=java
[EMAIL PROTECTED] 
uri=/WEB-INF/struts-html.tld
   prefix=html

html:form action=uploadAction.do enctype=multipart/form-data

Please Input Text: html:text property=myText
Please Input The File You Wish to Upload: html:file property=myFile
   
   html:submit /

/html:form




The next step is to create your ActionForm bean: 





import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;

public class UploadForm extends ActionForm {

protected String myText;
protected FormFile myFile;

public void setMyText(String text) {
myText = text;
}

public String getMyText() {
return myText;
}

public void setMyFile(FormFile file) {
myFile = file;
}

public FormFile getMyFile() {
return myFile;
}

}




RE: Upload Error

2003-06-26 Thread Bailey, Shane C.

Looks like you need commons-fileupload.jar in your classpath.

It appears org/apache/commons/fileupload/FileUploadException is an apache
commons file which can't be found to be loaded.

The struts file upload code must throw that exception or something.


-Original Message-
From: Flo [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 26, 2003 12:40 PM
To: [EMAIL PROTECTED]
Subject: Upload Error

I applied the folowing example to my project but a get an error :

java.lang.NoClassDefFoundError:
org/apache/commons/fileupload/FileUploadException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:1590)
at java.lang.Class.getConstructor0(Class.java:1762)
at java.lang.Class.newInstance0(Class.java:276)
at java.lang.Class.newInstance(Class.java:259)

http://jakarta.apache.org/struts/faqs/actionForm.html

[EMAIL PROTECTED] language=java
[EMAIL PROTECTED] 
uri=/WEB-INF/struts-html.tld
   prefix=html

html:form action=uploadAction.do enctype=multipart/form-data

Please Input Text: html:text property=myText
Please Input The File You Wish to Upload: html:file property=myFile
   
   html:submit /

/html:form





The next step is to create your ActionForm bean: 






import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;

public class UploadForm extends ActionForm {

protected String myText;
protected FormFile myFile;

public void setMyText(String text) {
myText = text;
}

public String getMyText() {
return myText;
}

public void setMyFile(FormFile file) {
myFile = file;
}

public FormFile getMyFile() {
return myFile;
}

}



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: File upload error when no file attached - IOException

2002-01-04 Thread Daniel WAMARA

Hi Doug, 

I don't know if you've already found solution to your problem but what you can do is 
to put a form validation in your ActionForm that handles that, here is what I did for 
mine (it also handles the case if a file is empty, saying with a 0 Kb size) :

/**
 * Validate the properties that have been set from this HTTP upload request,
 * and return an codeActionErrors/code object that encapsulates a
 * validation error relative to a missing file to be uploaded.  
 * If no errors are found, return 
 * codenull/code or an codeActionErrors/code object with no
 * recorded error messages.br
 *
 * Creation date: (13.11.01 19:19:10)
 *
 * @param mapping The mapping used to select this instance
 * @param request The servlet request we are processing
 *
 * @return ActionErrors
 */
 public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
 {
 ActionErrors errors = new ActionErrors();
 FormFile theFile = this.getThefile();   

 if (theFile == null || theFile.getFileName().length() == 0) // as Struts always 
do a temp file for each file you want to upload, theFile==null is always false
 errors.add(upload, new ActionError(uploadForm.error.uploadfile.required));

 if (theFile.getFileSize() == 0)
 errors.add(uploadsize, new 
ActionError(uploadForm.error.filesize.zero.notallowed));

 return errors;
 }

Hope it helps, 

Daniel



File upload error when no file attached - IOException

2001-12-30 Thread list

Hello,

There is a section of our app that allows a user to upload a file as an
attachment.  It is optional to upload a file, but other information on
the page is mandatory.

If no file is attached, the application hangs before executing the
Action that processes the form.  This only occurrs when no file is given
to upload. The process eventually times out and an IOException is
thrown.  I'm using the Struts 1.0 release.

I guess that someone else has run into this problem and am looking for
solutions/ workarounds.

Thank you very much for any help.

Doug



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




File upload error when no file attached - IOException

2001-12-30 Thread list

Hello, 

There is a section of our app that allows a user to upload a file as an
attachment.  It is optional to upload a file, but other information on
the page is mandatory. 

If no file is attached, the application hangs before executing the
Action that processes the form.  This only occurrs when no file is given
to upload. The process eventually times out and an IOException is
thrown.  I'm using the Struts 1.0 release. 

I guess that someone else has run into this problem and am looking for
solutions/ workarounds. 

Thank you very much for any help.

Doug