Re: multipart-request / file upload problem

2004-03-01 Thread Adam Hardy
Thanks for the exposÃ. :)  So it's worse than I feared! Well, I shall 
just come up with a convincing error message in those situations where I 
would have needed it, rather than try to force a square peg somewhere it 
doesn't want to go.

Adam

On 03/01/2004 08:23 PM Martin Cooper wrote:
I'm going to put this another way: what's the secret with file upload
requests? I can't see my file parameter in the request parameters when I
submit the form with the multipart-request.


Ah, if I told you that, it wouldn't be a secret any more, now would it? ;-)

The biggest difference with multipart requests is that the request is
wrapped by Struts, so when you invoke a method on the request object, you
are actually invoking a method on the MultipartRequestWrapper class. This is
necessary so that calls to, for example, getParameter() go to Struts, which
parsed your request, rather than the container, which didn't.
In the code fragment below, I see you are invoking getParameterMap(). Note
that this is a Servlet 2.3 method. Since Struts 1.x is built for Servlet
2.2, that method is not implemented, and simply returns null.
Actually, there isn't a way to get the file items from the request itself,
since it doesn't have them. They're stored in the multipart request handler
itself. So, you would get the set of uploaded file items like this:
Hashtable fileItems =
formBean.getMultipartRequestHandler().getFileElements();
I'll be the first to admit that the current multipart implementation is a
little, um, arcane (not that I invented it ;). The plan is to completely
rewrite it for Struts 2.x, when we get there.
Hope this helps.

--
Martin Cooper


Adam

On 02/29/2004 07:05 PM Adam Hardy wrote:

I use the Commons multipart request handler stuff to set up a
DynaActionForm properly for my file upload so:

 
type="org.apache.struts.upload.CommonsMultipartRequestHandler$CommonsFormFil
e"/>


which works fine, but in some circumstances I want to manually create
this form, grab the file and save the DynaActionForm (in a filter). Like
so:
ActionForm form =
 RequestUtils.createActionForm(request, actionMapping,
 moduleConfig, actionServlet);
form.reset(actionMapping, request);
BeanUtils.populate(form, request.getParameterMap());
But it isn't working. My file comes back as null. Anyone know why or
have a solution?


--
struts 1.1 + tomcat 5.0.16 + java 1.4.2
Linux 2.4.20 Debian
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: multipart-request / file upload problem

2004-03-01 Thread Martin Cooper

"Adam Hardy" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm going to put this another way: what's the secret with file upload
> requests? I can't see my file parameter in the request parameters when I
> submit the form with the multipart-request.

Ah, if I told you that, it wouldn't be a secret any more, now would it? ;-)

The biggest difference with multipart requests is that the request is
wrapped by Struts, so when you invoke a method on the request object, you
are actually invoking a method on the MultipartRequestWrapper class. This is
necessary so that calls to, for example, getParameter() go to Struts, which
parsed your request, rather than the container, which didn't.

In the code fragment below, I see you are invoking getParameterMap(). Note
that this is a Servlet 2.3 method. Since Struts 1.x is built for Servlet
2.2, that method is not implemented, and simply returns null.

Actually, there isn't a way to get the file items from the request itself,
since it doesn't have them. They're stored in the multipart request handler
itself. So, you would get the set of uploaded file items like this:

Hashtable fileItems =
formBean.getMultipartRequestHandler().getFileElements();

I'll be the first to admit that the current multipart implementation is a
little, um, arcane (not that I invented it ;). The plan is to completely
rewrite it for Struts 2.x, when we get there.

Hope this helps.

--
Martin Cooper


>
> Adam
>
> On 02/29/2004 07:05 PM Adam Hardy wrote:
> > I use the Commons multipart request handler stuff to set up a
> > DynaActionForm properly for my file upload so:
> >
> >  >   type="org.apache.struts.validator.DynaValidatorActionForm">
> >>
type="org.apache.struts.upload.CommonsMultipartRequestHandler$CommonsFormFil
e"/>
> >
> > 
> >
> > which works fine, but in some circumstances I want to manually create
> > this form, grab the file and save the DynaActionForm (in a filter). Like
> > so:
> >
> > ActionForm form =
> >   RequestUtils.createActionForm(request, actionMapping,
> >   moduleConfig, actionServlet);
> > form.reset(actionMapping, request);
> > BeanUtils.populate(form, request.getParameterMap());
> >
> > But it isn't working. My file comes back as null. Anyone know why or
> > have a solution?
> >
>
>
> -- 
> struts 1.1 + tomcat 5.0.16 + java 1.4.2
> Linux 2.4.20 Debian




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



Re: multipart-request / file upload problem

2004-03-01 Thread Adam Hardy
I'm going to put this another way: what's the secret with file upload 
requests? I can't see my file parameter in the request parameters when I 
submit the form with the multipart-request.

Adam

On 02/29/2004 07:05 PM Adam Hardy wrote:
I use the Commons multipart request handler stuff to set up a 
DynaActionForm properly for my file upload so:


  type="org.apache.struts.validator.DynaValidatorActionForm">
  
type="org.apache.struts.upload.CommonsMultipartRequestHandler$CommonsFormFile"/> 



which works fine, but in some circumstances I want to manually create 
this form, grab the file and save the DynaActionForm (in a filter). Like 
so:

ActionForm form =
  RequestUtils.createActionForm(request, actionMapping,
  moduleConfig, actionServlet);
form.reset(actionMapping, request);
BeanUtils.populate(form, request.getParameterMap());
But it isn't working. My file comes back as null. Anyone know why or 
have a solution?



--
struts 1.1 + tomcat 5.0.16 + java 1.4.2
Linux 2.4.20 Debian
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


multipart-request / file upload problem

2004-02-29 Thread Adam Hardy
I use the Commons multipart request handler stuff to set up a 
DynaActionForm properly for my file upload so:


  

which works fine, but in some circumstances I want to manually create 
this form, grab the file and save the DynaActionForm (in a filter). Like so:

ActionForm form =
  RequestUtils.createActionForm(request, actionMapping,
  moduleConfig, actionServlet);
form.reset(actionMapping, request);
BeanUtils.populate(form, request.getParameterMap());
But it isn't working. My file comes back as null. Anyone know why or 
have a solution?

--
struts 1.1 + tomcat 5.0.16 + java 1.4.2
Linux 2.4.20 Debian
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: File upload problem with Struts 1.1

2003-11-12 Thread Martin Cooper
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











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 problem with Struts 1.1

2003-11-12 Thread Caoilte O'Connor
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),
> >
> >> 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
> > >
> > >  > > enctype="multipart/form-data">
> > >
> > > 
> > >
> > > 
> > > 
> > > 
> > >
> > >
> > >
> > > 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

2003-11-12 Thread Garg Raman \(SDinc\)
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),
>
>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
> >
> >  > enctype="multipart/form-data">
> >
> > 
> >
> > 
> > 
> > 
> >
> >
> >
> > 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

2003-11-12 Thread Caoilte O'Connor
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),

  



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
>
>  enctype="multipart/form-data">
>
> 
>
> 
> 
> 
>
>
>
> 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]



File upload problem with Struts 1.1

2003-11-12 Thread Raman Garg
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











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

RE: file upload problem

2003-08-20 Thread Erez Efrati
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 
 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
st

RE: file upload problem

2003-08-20 Thread Brian McSweeney

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 comm

RE: file upload problem

2003-08-18 Thread Brian McSweeney
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 problem

2003-08-18 Thread Witbeck, Shane
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: [ot] Virus checking blobs was [Re: file upload problem]

2003-08-18 Thread Evan Schnell
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

2003-08-18 Thread Brian McSweeney

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]



[ot] Virus checking blobs was [Re: file upload problem]

2003-08-18 Thread Mark Lowe
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



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


RE: file upload problem

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



Re: file upload problem

2003-08-18 Thread Evan Schnell
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

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

2003-08-18 Thread Brian McSweeney
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

2003-08-18 Thread Witbeck, Shane
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

2003-08-18 Thread Brian McSweeney
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

2003-08-18 Thread Prashanth.S
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 - FileNotFoundException

2003-08-18 Thread Kuba

> 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 - FileNotFoundException

2003-08-18 Thread Brian McSweeney
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]



file upload problem - FileNotFoundException

2003-08-18 Thread Kuba
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.java:21
9)
 at
org.apache.struts.util.RequestUtils.getMultipartHandler(RequestUtils.java:10
46)
 at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:919)
 at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.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]



File Upload problem and Size Validation

2003-03-11 Thread Hemanth Setty
Hi all,
I am havig a problem on FileUploads in RC1...This problem occurs when I 
use the FormFile feature of struts. If the size of the file is lesser 
than the limit specified by the controller, everything seems to work 
fine...but when the size exceeds the limit then it fails on the 
validate() method of the form. But it does not redirect back to the same 
page. It returns to any empty page. The log level of debug shows correct 
redirects and even debug statements on the jsp prints out.. I dont know 
what the error could be.
I even tried the same thing with the struts-upload webapp that comes 
with RC1 and it was doing the same thing.
Any suggestions.??
Thanks
Hemanth



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


RE: file upload problem

2002-09-22 Thread Nicolas Robert

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]>


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


RE: file upload problem

2002-09-20 Thread Martin Cooper



> -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 problem

2002-09-20 Thread Tiago Nodari



 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

2002-09-20 Thread Mark Silva

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

2002-09-20 Thread Galbreath, Mark

It's really difficult to help without seeing your code.  Are you using
 in your ?  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

2002-09-20 Thread Martin Cooper

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

2002-09-20 Thread Tiago Nodari


 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:   
>For additional commands, e-mail: 



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




file upload problem

2002-09-20 Thread Mark Silva

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:   
For additional commands, e-mail: 




Struts 1.0.2 file upload problem, was working with Struts 0.5

2002-08-21 Thread Hareesh Subramanya

I am in the process of upgrading our application to struts 1.0.2 from
struts 0.5 ( I know it should have been done a lot earlier but still ... )
Everything is working as excepted except for this one problem when I try to
upload a file :

java.lang.IllegalArgumentException: argument type mismatch
 at java.lang.reflect.Method.invoke(Native Method)
 at
org.apache.struts.util.PropertyUtils.setSimpleProperty(PropertyUtils.java:988)
 at
org.apache.struts.util.PropertyUtils.setNestedProperty(PropertyUtils.java:904)
 at
org.apache.struts.util.PropertyUtils.setProperty(PropertyUtils.java:932)
 at org.apache.struts.util.BeanUtils.populate(BeanUtils.java:510)
 at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:772)
 at
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:2061)
 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:772)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
 at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1013)
 at allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java:925)
 at
allaire.jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatcher.java:88)
 at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1131)
 at allaire.jrun.servlet.JvmContext.dispatch(JvmContext.java:330)
 at allaire.jrun.http.WebEndpoint.run(WebEndpoint.java:107)
 at allaire.jrun.ThreadPool.run(ThreadPool.java:272)
 at allaire.jrun.WorkerThread.run(WorkerThread.java:75)

I used to get a servletException:BeanUtils.populate() error before I added
debug statements and extra catch segments in BeanUtils and PropertyUtils.

My JSP segment is :

















If any of you have any clues why I am getting this error it would greatly
help me. Again this feature used to work with the older version of struts
but it is not working with Struts 1.0.2

Thanks,
Hareesh


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




File upload problem (STILL)

2002-05-12 Thread @Basebeans.com

Subject: File upload problem (STILL)
From: Maurice Mills <[EMAIL PROTECTED]>
 ===
Maurice Mills wrote:

> I have a form and action that uploads a file.  Everything works until
> processing leaves the execute method of the Action class.  After that,
> Apache throws a ClassCastExcpetion on MultiPartRequestWrapper.
>
> This originally worked fine using v1.0.2, but when I upgraded to 1.1.b1
> this exception appears.  Nothing else in the code has changed.
>
> Is there anything that has changed in the implementation that I will
> need to handle in my code.
>
> I am running the application on JBoss 2.4.3 with embedded Tomcat 3.2.3.
> My browser is Mozilla 0.9.3.
>
> The stack trace is:
> java.lang.ClassCastException:
> org.apache.struts.upload.MultipartRequestWrapper
>  at
> 
>org.apache.tomcat.facade.RequestDispatcherImpl.doForward(RequestDispatcherImpl.java:172)
>
>  at
> 
>org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:162)
>
>  at
> org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:972)
>
>  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: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
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
>
>  at org.apache.tomcat.core.Handler.service(Handler.java:287)
>  at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
>  at
> org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
>
>  at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
>  at
> 
>org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
>
>  at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
>
>  at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
>
>  at java.lang.Thread.run(Thread.java:484)


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




RE: File Upload Problem.

2001-11-30 Thread SCHACHTER,MICHAEL (HP-NewJersey,ex2)

Marli,

Your multipart data seems to be right. Make sure you prefix it with
the normal HTTP headers that go with a multipart request, I think something
like:

Content-Type: multipart/form-data; boundary=...\r\n
--boundary
 -same stuff as you had for the multipart data goes here

If you're still having this problem, would you mind sending me the stuff
that you're using so I could take a look at it?


-Original Message-
From: Marli Satyadi [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 29, 2001 7:13 PM
To: Struts Users Mailing List; 'Struts Users Mailing List'
Subject: RE: File Upload Problem.



Hi Jon,

I am trying to do file upload programatically, not using the browser and I
want
to use the struts file upload library to achieve this.

So I want to try the library first by writing a simple html file and a
simple
servlet for testing.
Does this mean that I cannot use the upload code if I don't use struts tags
??

Thanks.
Marli.



At 09:42 AM 11/29/2001 +, Jon.Ridgway wrote:
>Hi Marli,
>
>I might be missing something here, but you don't appear to be using struts.
>Are you aware that there is a strurs tag for file upload? Have a look at
the
>struts examples.
>
>Jon.
>
>-Original Message-
>From: Marli Satyadi [mailto:[EMAIL PROTECTED]]
>Sent: 29 November 2001 01:23
>To: [EMAIL PROTECTED]
>Subject: File Upload Problem.
>
>Hello,
>
>I was writing some upload code to test the use of  MultipartIterator class.
>
>My html code is as follows:
>-
>
> MULTIPART TEST
>ACTION="/MDC/servlet/servlet/com.cisco.nm.callhome.servlet.TestServlet"
>ENCTYPE='multipart/form-data' METHOD="POST">
>
>CLASS: 
>
>COMMAND: 
>
>DATA (XML): 
>
>File Location: 
>
>
>
>
>
>
>
>My servlet code is as follows:
>---
>  protected void doPost(HttpServletRequest req, HttpServletResponse
>resp)
>  throws ServletException, java.io.IOException
>  {
>   LogUtil.debug(_Class, " -> DO POST");
>   MultipartIterator iter = new MultipartIterator(req, 64*1024,
>Integer.MAX_VALUE, "C:/Temp");
>
>   MultipartElement elem = null;
>   while( (elem = iter.getNextElement()) != null )
>   {
>  if( elem.isFile() )
>  {
> System.out.println("ELEM is a file");
> System.out.println("FILENAME = " +
elem.getFileName());
> System.out.println("FILE PATH = " +
>elem.getFile().getAbsolutePath());
>  }
>  else {
> System.out.print("NAME = '" + elem.getName() + "'");
> System.out.println(". VALUE = '" + elem.getValue() +
>"'");
> //System.out.println(elem.getName() + " = " +
>elem.getValue());
>  }
>   }
>
>  }
>
>When I use my browser to the html file, put some data in the "dataParam"
>text area and
>hit Submit,  I got the following result in Tomcat stdout.log
>
>NAME = 'class'. VALUE = 'File'
>NAME = 'cmd'. VALUE = 'Add'
>'sword>bejo1663eb7d56063ec67f23be
>ELEM is a file
>FILENAME = ch-p506-2_enable_callhome.cfg
>FILE PATH = C:\Temp\strts4674.tmp
>NAME = 'SUBMIT'. VALUE = 'Submit Query'
>
>My question is:
>--
>* Is there an explanation on why the "dataParam" parameter is not printed
>out,
>or printed out but has the wrong value ?
>* I also have written a Java multipart writer to test it, but it looks like
>that the file is always
>larger by 2 bytes. Isn't the format for multipart request like this:
>--Boundary\r\n
>content-disposition: form-data; name="blah"; filename="file.txt"\r\n
>Content-type: application/octet-stream\r\n
> \r\n
> Body goes here..
>--Boundary--\r\n
>Am I correct about the CRLF (\r\n) ? I have read RFC 1867 and RFC 2046
>and it looks correct.
>Any ideas ?
>
>Thanks in advance.
>Marli.
>
>
>--
>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.

2001-11-30 Thread Jon.Ridgway

Hi Marli,

No, you should be able to use the struts utils in your servlet. You will
have to manually create a FormFile however. Look at the source for the
html:file tag.

Jon. 

-Original Message-
From: Marli Satyadi [mailto:[EMAIL PROTECTED]] 
Sent: 30 November 2001 00:13
To: Struts Users Mailing List; 'Struts Users Mailing List'
Subject: RE: File Upload Problem.


Hi Jon,

I am trying to do file upload programatically, not using the browser and I
want
to use the struts file upload library to achieve this.

So I want to try the library first by writing a simple html file and a
simple
servlet for testing.
Does this mean that I cannot use the upload code if I don't use struts tags
??

Thanks.
Marli.



At 09:42 AM 11/29/2001 +, Jon.Ridgway wrote:
>Hi Marli,
>
>I might be missing something here, but you don't appear to be using struts.
>Are you aware that there is a strurs tag for file upload? Have a look at
the
>struts examples.
>
>Jon.
>
>-Original Message-
>From: Marli Satyadi [mailto:[EMAIL PROTECTED]]
>Sent: 29 November 2001 01:23
>To: [EMAIL PROTECTED]
>Subject: File Upload Problem.
>
>Hello,
>
>I was writing some upload code to test the use of  MultipartIterator class.
>
>My html code is as follows:
>-
>
> MULTIPART TEST
>ACTION="/MDC/servlet/servlet/com.cisco.nm.callhome.servlet.TestServlet"
>ENCTYPE='multipart/form-data' METHOD="POST">
>
>CLASS: 
>
>COMMAND: 
>
>DATA (XML): 
>
>File Location: 
>
>
>
>
>
>
>
>My servlet code is as follows:
>---
>  protected void doPost(HttpServletRequest req, HttpServletResponse
>resp)
>  throws ServletException, java.io.IOException
>  {
>   LogUtil.debug(_Class, " -> DO POST");
>   MultipartIterator iter = new MultipartIterator(req, 64*1024,
>Integer.MAX_VALUE, "C:/Temp");
>
>   MultipartElement elem = null;
>   while( (elem = iter.getNextElement()) != null )
>   {
>  if( elem.isFile() )
>  {
> System.out.println("ELEM is a file");
> System.out.println("FILENAME = " +
elem.getFileName());
> System.out.println("FILE PATH = " +
>elem.getFile().getAbsolutePath());
>  }
>  else {
> System.out.print("NAME = '" + elem.getName() + "'");
> System.out.println(". VALUE = '" + elem.getValue() +
>"'");
> //System.out.println(elem.getName() + " = " +
>elem.getValue());
>  }
>   }
>
>  }
>
>When I use my browser to the html file, put some data in the "dataParam"
>text area and
>hit Submit,  I got the following result in Tomcat stdout.log
>
>NAME = 'class'. VALUE = 'File'
>NAME = 'cmd'. VALUE = 'Add'
>'sword>bejo1663eb7d56063ec67f23be
>ELEM is a file
>FILENAME = ch-p506-2_enable_callhome.cfg
>FILE PATH = C:\Temp\strts4674.tmp
>NAME = 'SUBMIT'. VALUE = 'Submit Query'
>
>My question is:
>--
>* Is there an explanation on why the "dataParam" parameter is not printed
>out,
>or printed out but has the wrong value ?
>* I also have written a Java multipart writer to test it, but it looks like
>that the file is always
>larger by 2 bytes. Isn't the format for multipart request like this:
>--Boundary\r\n
>content-disposition: form-data; name="blah"; filename="file.txt"\r\n
>Content-type: application/octet-stream\r\n
> \r\n
> Body goes here..
>--Boundary--\r\n
>Am I correct about the CRLF (\r\n) ? I have read RFC 1867 and RFC 2046
>and it looks correct.
>Any ideas ?
>
>Thanks in advance.
>Marli.
>
>
>--
>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.

2001-11-29 Thread Marli Satyadi


Hi Jon,

I am trying to do file upload programatically, not using the browser and I want
to use the struts file upload library to achieve this.

So I want to try the library first by writing a simple html file and a simple
servlet for testing.
Does this mean that I cannot use the upload code if I don't use struts tags ??

Thanks.
Marli.



At 09:42 AM 11/29/2001 +, Jon.Ridgway wrote:
>Hi Marli,
>
>I might be missing something here, but you don't appear to be using struts.
>Are you aware that there is a strurs tag for file upload? Have a look at the
>struts examples.
>
>Jon.
>
>-Original Message-
>From: Marli Satyadi [mailto:[EMAIL PROTECTED]]
>Sent: 29 November 2001 01:23
>To: [EMAIL PROTECTED]
>Subject: File Upload Problem.
>
>Hello,
>
>I was writing some upload code to test the use of  MultipartIterator class.
>
>My html code is as follows:
>-
>
> MULTIPART TEST
>ACTION="/MDC/servlet/servlet/com.cisco.nm.callhome.servlet.TestServlet"
>ENCTYPE='multipart/form-data' METHOD="POST">
>
>CLASS: 
>
>COMMAND: 
>
>DATA (XML): 
>
>File Location: 
>
>
>
>
>
>
>
>My servlet code is as follows:
>---
>  protected void doPost(HttpServletRequest req, HttpServletResponse
>resp)
>  throws ServletException, java.io.IOException
>  {
>   LogUtil.debug(_Class, " -> DO POST");
>   MultipartIterator iter = new MultipartIterator(req, 64*1024,
>Integer.MAX_VALUE, "C:/Temp");
>
>   MultipartElement elem = null;
>   while( (elem = iter.getNextElement()) != null )
>   {
>  if( elem.isFile() )
>  {
> System.out.println("ELEM is a file");
> System.out.println("FILENAME = " + elem.getFileName());
> System.out.println("FILE PATH = " +
>elem.getFile().getAbsolutePath());
>  }
>  else {
> System.out.print("NAME = '" + elem.getName() + "'");
> System.out.println(". VALUE = '" + elem.getValue() +
>"'");
> //System.out.println(elem.getName() + " = " +
>elem.getValue());
>  }
>   }
>
>  }
>
>When I use my browser to the html file, put some data in the "dataParam"
>text area and
>hit Submit,  I got the following result in Tomcat stdout.log
>
>NAME = 'class'. VALUE = 'File'
>NAME = 'cmd'. VALUE = 'Add'
>'sword>bejo1663eb7d56063ec67f23be
>ELEM is a file
>FILENAME = ch-p506-2_enable_callhome.cfg
>FILE PATH = C:\Temp\strts4674.tmp
>NAME = 'SUBMIT'. VALUE = 'Submit Query'
>
>My question is:
>--
>* Is there an explanation on why the "dataParam" parameter is not printed
>out,
>or printed out but has the wrong value ?
>* I also have written a Java multipart writer to test it, but it looks like
>that the file is always
>larger by 2 bytes. Isn't the format for multipart request like this:
>--Boundary\r\n
>content-disposition: form-data; name="blah"; filename="file.txt"\r\n
>Content-type: application/octet-stream\r\n
> \r\n
> Body goes here..
>--Boundary--\r\n
>Am I correct about the CRLF (\r\n) ? I have read RFC 1867 and RFC 2046
>and it looks correct.
>Any ideas ?
>
>Thanks in advance.
>Marli.
>
>
>--
>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.

2001-11-29 Thread Marli Satyadi

Hi Mike, I tested both with IE 6.0 and Netscape 4.5.
Both give the same problem.

Any idea whether I'm sending the CRLF correctly ?

Thanks.
Marli.


At 07:49 AM 11/29/2001 -0800, SCHACHTER,MICHAEL (HP-NewJersey,ex2) wrote:
>Hi,
>
>What browser are you using to submit the form? Also,
>you may already be aware, but as mentioned by the
>other reply there's an easy way to handle multipart
>form data in Struts, you can check out the struts-upload
>webapp in the distribution for an example.
>
>As with your use of MultipartIterator, I'm not sure what
>the problem could be there.
>
>-Original Message-
>From: Marli Satyadi [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, November 28, 2001 8:23 PM
>To: [EMAIL PROTECTED]
>Subject: File Upload Problem.
>
>
>Hello,
>
>I was writing some upload code to test the use of  MultipartIterator class.
>
>My html code is as follows:
>-
>
> MULTIPART TEST
>ACTION="/MDC/servlet/servlet/com.cisco.nm.callhome.servlet.TestServlet"
>ENCTYPE='multipart/form-data' METHOD="POST">
>
>CLASS: 
>
>COMMAND: 
>
>DATA (XML): 
>
>File Location: 
>
>
>
>
>
>
>
>My servlet code is as follows:
>---
>  protected void doPost(HttpServletRequest req, HttpServletResponse
>resp)
>  throws ServletException, java.io.IOException
>  {
>   LogUtil.debug(_Class, " -> DO POST");
>   MultipartIterator iter = new MultipartIterator(req, 64*1024,
>Integer.MAX_VALUE, "C:/Temp");
>
>   MultipartElement elem = null;
>   while( (elem = iter.getNextElement()) != null )
>   {
>  if( elem.isFile() )
>  {
> System.out.println("ELEM is a file");
> System.out.println("FILENAME = " + elem.getFileName());
> System.out.println("FILE PATH = " +
>elem.getFile().getAbsolutePath());
>  }
>  else {
> System.out.print("NAME = '" + elem.getName() + "'");
> System.out.println(". VALUE = '" + elem.getValue() +
>"'");
> //System.out.println(elem.getName() + " = " +
>elem.getValue());
>  }
>   }
>
>  }
>
>When I use my browser to the html file, put some data in the "dataParam"
>text area and
>hit Submit,  I got the following result in Tomcat stdout.log
>
>NAME = 'class'. VALUE = 'File'
>NAME = 'cmd'. VALUE = 'Add'
>'sword>bejo1663eb7d56063ec67f23be
>ELEM is a file
>FILENAME = ch-p506-2_enable_callhome.cfg
>FILE PATH = C:\Temp\strts4674.tmp
>NAME = 'SUBMIT'. VALUE = 'Submit Query'
>
>My question is:
>--
>* Is there an explanation on why the "dataParam" parameter is not printed
>out,
>or printed out but has the wrong value ?
>* I also have written a Java multipart writer to test it, but it looks like
>that the file is always
>larger by 2 bytes. Isn't the format for multipart request like this:
>--Boundary\r\n
>content-disposition: form-data; name="blah"; filename="file.txt"\r\n
>Content-type: application/octet-stream\r\n
> \r\n
> Body goes here..
>--Boundary--\r\n
>Am I correct about the CRLF (\r\n) ? I have read RFC 1867 and RFC 2046
>and it looks correct.
>Any ideas ?
>
>Thanks in advance.
>Marli.
>
>
>--
>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.

2001-11-29 Thread SCHACHTER,MICHAEL (HP-NewJersey,ex2)

Hi,

What browser are you using to submit the form? Also,
you may already be aware, but as mentioned by the
other reply there's an easy way to handle multipart
form data in Struts, you can check out the struts-upload 
webapp in the distribution for an example.  

As with your use of MultipartIterator, I'm not sure what 
the problem could be there.

-Original Message-
From: Marli Satyadi [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 28, 2001 8:23 PM
To: [EMAIL PROTECTED]
Subject: File Upload Problem.


Hello,

I was writing some upload code to test the use of  MultipartIterator class.

My html code is as follows:
-

 MULTIPART TEST


CLASS: 

COMMAND: 

DATA (XML): 

File Location: 







My servlet code is as follows:
---
 protected void doPost(HttpServletRequest req, HttpServletResponse 
resp)
 throws ServletException, java.io.IOException
 {
  LogUtil.debug(_Class, " -> DO POST");
  MultipartIterator iter = new MultipartIterator(req, 64*1024, 
Integer.MAX_VALUE, "C:/Temp");

  MultipartElement elem = null;
  while( (elem = iter.getNextElement()) != null )
  {
 if( elem.isFile() )
 {
System.out.println("ELEM is a file");
System.out.println("FILENAME = " + elem.getFileName());
System.out.println("FILE PATH = " + 
elem.getFile().getAbsolutePath());
 }
 else {
System.out.print("NAME = '" + elem.getName() + "'");
System.out.println(". VALUE = '" + elem.getValue() +
"'");
//System.out.println(elem.getName() + " = " + 
elem.getValue());
 }
  }

 }

When I use my browser to the html file, put some data in the "dataParam" 
text area and
hit Submit,  I got the following result in Tomcat stdout.log

NAME = 'class'. VALUE = 'File'
NAME = 'cmd'. VALUE = 'Add'
'sword>bejo1663eb7d56063ec67f23be
ELEM is a file
FILENAME = ch-p506-2_enable_callhome.cfg
FILE PATH = C:\Temp\strts4674.tmp
NAME = 'SUBMIT'. VALUE = 'Submit Query'

My question is:
--
* Is there an explanation on why the "dataParam" parameter is not printed
out,
or printed out but has the wrong value ?
* I also have written a Java multipart writer to test it, but it looks like 
that the file is always
   larger by 2 bytes. Isn't the format for multipart request like this:
   --Boundary\r\n
   content-disposition: form-data; name="blah"; filename="file.txt"\r\n
   Content-type: application/octet-stream\r\n
\r\n
Body goes here..
   --Boundary--\r\n
   Am I correct about the CRLF (\r\n) ? I have read RFC 1867 and RFC 2046 
and it looks correct.
   Any ideas ?

Thanks in advance.
Marli.


--
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.

2001-11-29 Thread Jon.Ridgway

Hi Marli,

I might be missing something here, but you don't appear to be using struts.
Are you aware that there is a strurs tag for file upload? Have a look at the
struts examples.

Jon.

-Original Message-
From: Marli Satyadi [mailto:[EMAIL PROTECTED]] 
Sent: 29 November 2001 01:23
To: [EMAIL PROTECTED]
Subject: File Upload Problem.

Hello,

I was writing some upload code to test the use of  MultipartIterator class.

My html code is as follows:
-

 MULTIPART TEST


CLASS: 

COMMAND: 

DATA (XML): 

File Location: 







My servlet code is as follows:
---
 protected void doPost(HttpServletRequest req, HttpServletResponse 
resp)
 throws ServletException, java.io.IOException
 {
  LogUtil.debug(_Class, " -> DO POST");
  MultipartIterator iter = new MultipartIterator(req, 64*1024, 
Integer.MAX_VALUE, "C:/Temp");

  MultipartElement elem = null;
  while( (elem = iter.getNextElement()) != null )
  {
 if( elem.isFile() )
 {
System.out.println("ELEM is a file");
System.out.println("FILENAME = " + elem.getFileName());
System.out.println("FILE PATH = " + 
elem.getFile().getAbsolutePath());
 }
 else {
System.out.print("NAME = '" + elem.getName() + "'");
System.out.println(". VALUE = '" + elem.getValue() +
"'");
//System.out.println(elem.getName() + " = " + 
elem.getValue());
 }
  }

 }

When I use my browser to the html file, put some data in the "dataParam" 
text area and
hit Submit,  I got the following result in Tomcat stdout.log

NAME = 'class'. VALUE = 'File'
NAME = 'cmd'. VALUE = 'Add'
'sword>bejo1663eb7d56063ec67f23be
ELEM is a file
FILENAME = ch-p506-2_enable_callhome.cfg
FILE PATH = C:\Temp\strts4674.tmp
NAME = 'SUBMIT'. VALUE = 'Submit Query'

My question is:
--
* Is there an explanation on why the "dataParam" parameter is not printed
out,
or printed out but has the wrong value ?
* I also have written a Java multipart writer to test it, but it looks like 
that the file is always
   larger by 2 bytes. Isn't the format for multipart request like this:
   --Boundary\r\n
   content-disposition: form-data; name="blah"; filename="file.txt"\r\n
   Content-type: application/octet-stream\r\n
\r\n
Body goes here..
   --Boundary--\r\n
   Am I correct about the CRLF (\r\n) ? I have read RFC 1867 and RFC 2046 
and it looks correct.
   Any ideas ?

Thanks in advance.
Marli.


--
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]>




File Upload Problem.

2001-11-28 Thread Marli Satyadi

Hello,

I was writing some upload code to test the use of  MultipartIterator class.

My html code is as follows:
-

 MULTIPART TEST


CLASS: 

COMMAND: 

DATA (XML): 

File Location: 







My servlet code is as follows:
---
 protected void doPost(HttpServletRequest req, HttpServletResponse 
resp)
 throws ServletException, java.io.IOException
 {
  LogUtil.debug(_Class, " -> DO POST");
  MultipartIterator iter = new MultipartIterator(req, 64*1024, 
Integer.MAX_VALUE, "C:/Temp");

  MultipartElement elem = null;
  while( (elem = iter.getNextElement()) != null )
  {
 if( elem.isFile() )
 {
System.out.println("ELEM is a file");
System.out.println("FILENAME = " + elem.getFileName());
System.out.println("FILE PATH = " + 
elem.getFile().getAbsolutePath());
 }
 else {
System.out.print("NAME = '" + elem.getName() + "'");
System.out.println(". VALUE = '" + elem.getValue() + "'");
//System.out.println(elem.getName() + " = " + 
elem.getValue());
 }
  }

 }

When I use my browser to the html file, put some data in the "dataParam" 
text area and
hit Submit,  I got the following result in Tomcat stdout.log

NAME = 'class'. VALUE = 'File'
NAME = 'cmd'. VALUE = 'Add'
'sword>bejo1663eb7d56063ec67f23be
ELEM is a file
FILENAME = ch-p506-2_enable_callhome.cfg
FILE PATH = C:\Temp\strts4674.tmp
NAME = 'SUBMIT'. VALUE = 'Submit Query'

My question is:
--
* Is there an explanation on why the "dataParam" parameter is not printed out,
or printed out but has the wrong value ?
* I also have written a Java multipart writer to test it, but it looks like 
that the file is always
   larger by 2 bytes. Isn't the format for multipart request like this:
   --Boundary\r\n
   content-disposition: form-data; name="blah"; filename="file.txt"\r\n
   Content-type: application/octet-stream\r\n
\r\n
Body goes here..
   --Boundary--\r\n
   Am I correct about the CRLF (\r\n) ? I have read RFC 1867 and RFC 2046 
and it looks correct.
   Any ideas ?

Thanks in advance.
Marli.


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: File Upload Problem

2001-10-04 Thread Hansen, Susan

Hi Tom, Thanks, my file uploads with no problem.

On Thursday 04 October 2001 12:38 pm, Tom Tibbetts wrote:
> Hi Susan.  Go to Bugzilla and look up bug #3702 and download the the last
> two attachments and build them under the struts.upload package.  This
> should get you by until the code owner for file upload submits a permanent
> patch.
>
> At 12:20 PM 10/4/2001 -0400, you wrote:
> >Hi,
> >Does anybody know what I can do to resolve the following problem with the
> >file upload?
> >
> >Summary of problem:
> >I am using the struts nightly build from 10-4-2001 and java version
> >"1.3.1_01".
> >I have the  maxFileSize set to 10M.  The file I am loading is around 7M.
> >
> >The file upload works great exception for this large binary pdf file.
> >When I try to upload the file I  get the follow exception:
> >
> >2001-10-04 11:43:17 - Ctx( /editor ): Exception in: R( /editor +
> >/protected/createFundDocument.do + null) -
> >java.lang.ArrayIndexOutOfBoundsException
> > at
> >org.apache.struts.upload.MultipartIterator.equals(MultipartIterator.java:5
> >41) at
> >org.apache.struts.upload.MultipartIterator.createLocalFile(MultipartIterat
> >or.java:490) at
> >org.apache.struts.upload.MultipartIterator.getNextElement(MultipartIterato
> >r.java:217) at
> >org.apache.struts.upload.DiskMultipartRequestHandler.handleRequest(DiskMul
> >tipartRequestHandler.java:76) at
> > org.apache.struts.util.RequestUtils.populate(RequestUtils.java:690)
> > at
> >org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:
> >1993) at
> >org.apache.struts.action.ActionServlet.process(ActionServlet.java:1496)
> > at
> >org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:504)
> >at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > at
> >org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
> > at org.apache.tomcat.core.Handler.service(Handler.java:287)
> > at
> >org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> > at
> >org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:
> >812) at
> >org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
> > at
> >org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(Htt
> >pConnectionHandler.java:213) at
> >org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
> > at
> >org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
> > at java.lang.Thread.run(Thread.java:484)



RE: File Upload Problem

2001-10-04 Thread SCHACHTER,MICHAEL (HP-NewJersey,ex2)

Hi,

I'll be working on this problem today

 - Mike

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 04, 2001 12:21 PM
To: [EMAIL PROTECTED]
Subject: File Upload Problem



Hi,
Does anybody know what I can do to resolve the following problem with the 
file upload?

Summary of problem:
I am using the struts nightly build from 10-4-2001 and java version 
"1.3.1_01".
I have the  maxFileSize set to 10M.  The file I am loading is around 7M.

The file upload works great exception for this large binary pdf file.
When I try to upload the file I  get the follow exception:

2001-10-04 11:43:17 - Ctx( /editor ): Exception in: R( /editor + 
/protected/createFundDocument.do + null) - 
java.lang.ArrayIndexOutOfBoundsException
at 
org.apache.struts.upload.MultipartIterator.equals(MultipartIterator.java:541
)
at 
org.apache.struts.upload.MultipartIterator.createLocalFile(MultipartIterator
.java:490)
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:690)
at 
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:19
93)
at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1496)
at 
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:504)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at 
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at 
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at 
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:81
2)
at 
org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
at 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:213)
at 
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at 
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:484)



Re: File Upload Problem

2001-10-04 Thread Tom Tibbetts

Hi Susan.  Go to Bugzilla and look up bug #3702 and download the the last 
two attachments and build them under the struts.upload package.  This 
should get you by until the code owner for file upload submits a permanent 
patch.

At 12:20 PM 10/4/2001 -0400, you wrote:

>Hi,
>Does anybody know what I can do to resolve the following problem with the
>file upload?
>
>Summary of problem:
>I am using the struts nightly build from 10-4-2001 and java version
>"1.3.1_01".
>I have the  maxFileSize set to 10M.  The file I am loading is around 7M.
>
>The file upload works great exception for this large binary pdf file.
>When I try to upload the file I  get the follow exception:
>
>2001-10-04 11:43:17 - Ctx( /editor ): Exception in: R( /editor +
>/protected/createFundDocument.do + null) -
>java.lang.ArrayIndexOutOfBoundsException
> at
>org.apache.struts.upload.MultipartIterator.equals(MultipartIterator.java:541)
> at
>org.apache.struts.upload.MultipartIterator.createLocalFile(MultipartIterator.java:490)
> at
>org.apache.struts.upload.MultipartIterator.getNextElement(MultipartIterator.java:217)
> at
>org.apache.struts.upload.DiskMultipartRequestHandler.handleRequest(DiskMultipartRequestHandler.java:76)
> at 
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:690)
> at
>org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:1993)
> at
>org.apache.struts.action.ActionServlet.process(ActionServlet.java:1496)
> at
>org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:504)
>at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
> at org.apache.tomcat.core.Handler.service(Handler.java:287)
> at
>org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> at
>org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
> at
>org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
> at
>org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
> at
>org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
> at
>org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
> at java.lang.Thread.run(Thread.java:484)




File Upload Problem

2001-10-04 Thread Hansen, Susan


Hi,
Does anybody know what I can do to resolve the following problem with the 
file upload?

Summary of problem:
I am using the struts nightly build from 10-4-2001 and java version 
"1.3.1_01".
I have the  maxFileSize set to 10M.  The file I am loading is around 7M.

The file upload works great exception for this large binary pdf file.
When I try to upload the file I  get the follow exception:

2001-10-04 11:43:17 - Ctx( /editor ): Exception in: R( /editor + 
/protected/createFundDocument.do + null) - 
java.lang.ArrayIndexOutOfBoundsException
at 
org.apache.struts.upload.MultipartIterator.equals(MultipartIterator.java:541)
at 
org.apache.struts.upload.MultipartIterator.createLocalFile(MultipartIterator.java:490)
at 
org.apache.struts.upload.MultipartIterator.getNextElement(MultipartIterator.java:217)
at 
org.apache.struts.upload.DiskMultipartRequestHandler.handleRequest(DiskMultipartRequestHandler.java:76)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:690)
at 
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:1993)
at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1496)
at 
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:504)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at 
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at 
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at 
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
at 
org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
at 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at 
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at 
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:484)




File upload problem in Struts 1.0

2001-07-23 Thread Imran Zafer

We have recently switched to Struts 1.0 from a previous beta version.
After migrating we are having problems in uploading certain files. The
files do get uploaded to the server but the contents get corrupted some
times. We further investigate this problem and found out that files get
damaged when they contains non-English content. E.g. if we upload a
Microsoft Excel file that contains non-English characters it got
corrupted, and we are unable to process that file with MS Excel
afterwards. The problems disappears if we switch back to old struts.jar
file.
 
Any ideas how to fix this problem. Is it safe to replace the struts.jar
file with old one as in interim solution?.



RE: File Upload Problem

2001-06-26 Thread Darryl Pentz

Just to confirm to the NG that we do seem to have a problem with the way
that org.apache.struts.upload.MultipartIterator.java does the
createLocalFile(). I've tested this quite a bit today and have found that
Struts-b1 worked fine with this spreadsheet. Thereafter, the
createLocalFile() was COMPLETELY redesigned and it's also with this redesign
that the spreadsheet gets corrupted.

The change fixed the problem some found uploading ZIP files (including
myself) but this new problem persists.

thanks,
Darryl

-Original Message-
From: Darryl Pentz [mailto:[EMAIL PROTECTED]]
Sent: 26 June 2001 13:47
To: [EMAIL PROTECTED]
Subject: RE: File Upload Problem


That's just it. We HAVE upgraded to Struts 1.0 final. This fixed a problem
we were having with ZIP files but now it seems we can't view spreadsheets
and documents that are successfully uploaded. In other words, they do upload
fine, but when you try and view them, Excel can't open them up.

- Darryl

-Original Message-
From: Krueger, Jeff [mailto:[EMAIL PROTECTED]]
Sent: 26 June 2001 13:22
To: [EMAIL PROTECTED]
Subject: RE: File Upload Problem


I just got done fighting this problem for the last week.  Upgrade to struts
1.0 and that will solve your problem.

Jeff Krueger


-Original Message-
From: Darryl Pentz [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 26, 2001 4:38 AM
To: [EMAIL PROTECTED]
Subject: File Upload Problem


Hi all,

Has anyone else experienced problems with the file upload lately? I'm
finding that uploaded files are being corrupted. It doesn't seem to matter
what type the document is. I've found an Excel spreadsheet and a Word
document that have displayed problems. It seems, doing a binary compare,
that a 0A is being inserted arbitrarily. I'm looking at
MultipartIterator.java as the possible culprit as that's where a 0A ('\n')
is being inserted.

If anyone can point out the error of my ways I'd appreciate it. I don't know
why we're only finding this problem now since we've been testing uploads
regularly. Unless it has to do with the fixes in 1.0 final that maybe broke
something. I'm a little out of my depth here since I'm still fairly new to
the intricacies of Struts.

thanks,
Darryl





RE: File Upload Problem

2001-06-26 Thread Darryl Pentz

That's just it. We HAVE upgraded to Struts 1.0 final. This fixed a problem
we were having with ZIP files but now it seems we can't view spreadsheets
and documents that are successfully uploaded. In other words, they do upload
fine, but when you try and view them, Excel can't open them up.

- Darryl

-Original Message-
From: Krueger, Jeff [mailto:[EMAIL PROTECTED]]
Sent: 26 June 2001 13:22
To: [EMAIL PROTECTED]
Subject: RE: File Upload Problem


I just got done fighting this problem for the last week.  Upgrade to struts
1.0 and that will solve your problem.

Jeff Krueger


-Original Message-
From: Darryl Pentz [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 26, 2001 4:38 AM
To: [EMAIL PROTECTED]
Subject: File Upload Problem


Hi all,

Has anyone else experienced problems with the file upload lately? I'm
finding that uploaded files are being corrupted. It doesn't seem to matter
what type the document is. I've found an Excel spreadsheet and a Word
document that have displayed problems. It seems, doing a binary compare,
that a 0A is being inserted arbitrarily. I'm looking at
MultipartIterator.java as the possible culprit as that's where a 0A ('\n')
is being inserted.

If anyone can point out the error of my ways I'd appreciate it. I don't know
why we're only finding this problem now since we've been testing uploads
regularly. Unless it has to do with the fixes in 1.0 final that maybe broke
something. I'm a little out of my depth here since I'm still fairly new to
the intricacies of Struts.

thanks,
Darryl




RE: File Upload Problem

2001-06-26 Thread Krueger, Jeff

I just got done fighting this problem for the last week.  Upgrade to struts
1.0 and that will solve your problem.

Jeff Krueger


-Original Message-
From: Darryl Pentz [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 26, 2001 4:38 AM
To: [EMAIL PROTECTED]
Subject: File Upload Problem


Hi all,

Has anyone else experienced problems with the file upload lately? I'm
finding that uploaded files are being corrupted. It doesn't seem to matter
what type the document is. I've found an Excel spreadsheet and a Word
document that have displayed problems. It seems, doing a binary compare,
that a 0A is being inserted arbitrarily. I'm looking at
MultipartIterator.java as the possible culprit as that's where a 0A ('\n')
is being inserted.

If anyone can point out the error of my ways I'd appreciate it. I don't know
why we're only finding this problem now since we've been testing uploads
regularly. Unless it has to do with the fixes in 1.0 final that maybe broke
something. I'm a little out of my depth here since I'm still fairly new to
the intricacies of Struts.

thanks,
Darryl



File Upload Problem

2001-06-26 Thread Darryl Pentz

Hi all,

Has anyone else experienced problems with the file upload lately? I'm
finding that uploaded files are being corrupted. It doesn't seem to matter
what type the document is. I've found an Excel spreadsheet and a Word
document that have displayed problems. It seems, doing a binary compare,
that a 0A is being inserted arbitrarily. I'm looking at
MultipartIterator.java as the possible culprit as that's where a 0A ('\n')
is being inserted.

If anyone can point out the error of my ways I'd appreciate it. I don't know
why we're only finding this problem now since we've been testing uploads
regularly. Unless it has to do with the fixes in 1.0 final that maybe broke
something. I'm a little out of my depth here since I'm still fairly new to
the intricacies of Struts.

thanks,
Darryl