Re: File upload location

2004-03-24 Thread Mark Shifman
Deepak wrote:

Hi,
   What is the default location of a file uploaded using html:file ? Can I upload it to one of the folders in my context path ?
 

It goes someplace temporary. If you look at the src for the UploadAction 
example in Struts, it shows how to save the temporary file.

I create a temporary dir with sessionCreated() in the 
HttpSessionListener ie myapp/temp/sessionID

then you can get to it via 
session.getServletContext().getRealPath(temp) + /+ session.getId();

and create an outputstream that goes there.

When the session is destroyed I remove the files and the dir 
myapp/temp/sessionID

thanks
Deepak
 



--
Mark Shifman MD. Ph.D.
Yale Center for Medical Informatics
Phone (203)737-5219
[EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


File upload location

2004-03-23 Thread Deepak

Hi,
What is the default location of a file uploaded using html:file ? Can I upload 
it to one of the folders in my context path ?

thanks
Deepak


Recommend file upload progress bar

2004-03-20 Thread Frank Burns
I have a requirement to display a progress bar while performing file
uploads. I've found several frameworks that provide this functionality.
However, can you recommend an existing *best* solution -- preferably
off-the-shelf -- for use with Struts?
Thanks,
Frank



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



Re: Recommend file upload progress bar

2004-03-20 Thread Max Cooper
See the thread File-Upload: Progress-Bar that has been going on over the
last few days.

-Max

- Original Message - 
From: Frank Burns [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Saturday, March 20, 2004 1:57 AM
Subject: Recommend file upload progress bar


 I have a requirement to display a progress bar while performing file
 uploads. I've found several frameworks that provide this functionality.
 However, can you recommend an existing *best* solution -- preferably
 off-the-shelf -- for use with Struts?
 Thanks,
 Frank



 -
 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: Progress-Bar

2004-03-19 Thread Tim . Adler
Hello everybody!
 
I'm up to the task to implement a progress bar for File-Uploads, cause the
files that are uploaded to my Webapp can be quite large.
Well as usual this problem is not easily solved on the HTTP-Browser upload
side.
 
I'm using Struts here so I'm also using the commons/FileUpload. I was
planning to do it that way that I assign a unique number to every
session's-upload and keep the current status of an upload in a singleton for
access. In an additional frame (with refresh) I would like to show the
progress bar.
 
My question: Has anybody done something like this with Struts before and can
give me some little advise? Or more specific: Is it possible to first get
the complete filesize from the FormFiles and the do the real Upload during
the Action (keeping track of the read bytes)
 
Thx for every help!!

___
Tim Adler, Abt. SDA1
Adress Management Solutions
AZ | Direct
Carl-Bertelsmann Straße 161s
D-33311 Gütersloh

Tel.: 05241/ 80 - 89574
[EMAIL PROTECTED] 

 


Re: File-Upload: Progress-Bar

2004-03-19 Thread Max Cooper
A simpler solution that may still meet your needs might be to use an
animated GIF on a pop-up just to give the user some feedback that the upload
is still in progress and that they should be patient.

You could setup something like this:

The HTML form with upload file input element has a hidden field with some
UUID generated by the Action. The UUID is just some unique ID to avoid
having two upload forms with the same ID. For instance, the session-id or
perhaps session-id+current_time would work fine for a UUID.

Have the javascript onSubmit for the form pop-up a window, where the content
of that window will be /uploadStatus.do?UUID=234344.

Your /uploadStatus.do action will look for the UUID and forward to a JSP
with the animated GIF in it if that file has not completed uploading. That
JSP will have a meta-refresh in it that will refresh the content of the
pop-up every few seconds.

The form submit with the file upload input element will be uploading the
file for a while. When it finishes, it will indicate that the file upload
with UUID=234344 has completed to some server-side upload-tracking
subsystem. Then it will forward or redirect to whatever page the user should
see when the upload completes.

The pop-up status window will refresh itself within a second or two, and the
/uploadStatus.do action will determine that the upload for the file with
UUID=234344 has completed (by checking with the server-side upload-tracking
subsystem). It will then forward to a JSP that closes the pop-up window or
shows a message that the upload has completed.


This isn't a progress bar, but it should be easier to implement. You could
even use a fast-cycling animated GIF that looks like a progress bar (but
doesn't really relate to the actual % progress) if that would satisfy your
UI design requirements.

-Max

- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, March 19, 2004 1:31 AM
Subject: File-Upload: Progress-Bar


Hello everybody!

I'm up to the task to implement a progress bar for File-Uploads, cause the
files that are uploaded to my Webapp can be quite large.
Well as usual this problem is not easily solved on the HTTP-Browser upload
side.

I'm using Struts here so I'm also using the commons/FileUpload. I was
planning to do it that way that I assign a unique number to every
session's-upload and keep the current status of an upload in a singleton for
access. In an additional frame (with refresh) I would like to show the
progress bar.

My question: Has anybody done something like this with Struts before and can
give me some little advise? Or more specific: Is it possible to first get
the complete filesize from the FormFiles and the do the real Upload during
the Action (keeping track of the read bytes)

Thx for every help!!

___
Tim Adler, Abt. SDA1
Adress Management Solutions
AZ | Direct
Carl-Bertelsmann Straße 161s
D-33311 Gütersloh

Tel.: 05241/ 80 - 89574
[EMAIL PROTECTED]




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



AW: File-Upload: Progress-Bar

2004-03-19 Thread Tim . Adler
Well that was generally what I was planning to do. The GIF-animation is
somewhat a good idea, but if I do such an server-side upload system, then I
could also do a real-percentage progress bar. I think a simple
open-window-close-window could be done with JavaScript also. But anyway
thanks for the suggestion.

Now the tricky part is: How do I do this server-side upload-system? Perhaps
you can help here also. I already implemented a singleton that keeps track
of upload-numbers for every session. So that I always have a unique
identifier combined out SessionId and Upload-Number.

My problem is tracking down the current status of an upload. Meaning: When I
upload files with Struts then the File is immediately available through the
FormFiles. Now: Is it possible to handle this upload through the
FileForm.getInputStream(). Or is the File already completely read, when I
get access to that method in the Action?! And if that is so, do I have to
parse the Multipart-Request by myself then??

-Ursprüngliche Nachricht-
Von: Max Cooper [mailto:[EMAIL PROTECTED]
Gesendet: Freitag, 19. März 2004 12:03
An: Struts Users Mailing List
Betreff: Re: File-Upload: Progress-Bar


A simpler solution that may still meet your needs might be to use an
animated GIF on a pop-up just to give the user some feedback that the upload
is still in progress and that they should be patient.

You could setup something like this:

The HTML form with upload file input element has a hidden field with some
UUID generated by the Action. The UUID is just some unique ID to avoid
having two upload forms with the same ID. For instance, the session-id or
perhaps session-id+current_time would work fine for a UUID.

Have the javascript onSubmit for the form pop-up a window, where the content
of that window will be /uploadStatus.do?UUID=234344.

Your /uploadStatus.do action will look for the UUID and forward to a JSP
with the animated GIF in it if that file has not completed uploading. That
JSP will have a meta-refresh in it that will refresh the content of the
pop-up every few seconds.

The form submit with the file upload input element will be uploading the
file for a while. When it finishes, it will indicate that the file upload
with UUID=234344 has completed to some server-side upload-tracking
subsystem. Then it will forward or redirect to whatever page the user should
see when the upload completes.

The pop-up status window will refresh itself within a second or two, and the
/uploadStatus.do action will determine that the upload for the file with
UUID=234344 has completed (by checking with the server-side upload-tracking
subsystem). It will then forward to a JSP that closes the pop-up window or
shows a message that the upload has completed.


This isn't a progress bar, but it should be easier to implement. You could
even use a fast-cycling animated GIF that looks like a progress bar (but
doesn't really relate to the actual % progress) if that would satisfy your
UI design requirements.

-Max

- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, March 19, 2004 1:31 AM
Subject: File-Upload: Progress-Bar


Hello everybody!

I'm up to the task to implement a progress bar for File-Uploads, cause the
files that are uploaded to my Webapp can be quite large.
Well as usual this problem is not easily solved on the HTTP-Browser upload
side.

I'm using Struts here so I'm also using the commons/FileUpload. I was
planning to do it that way that I assign a unique number to every
session's-upload and keep the current status of an upload in a singleton for
access. In an additional frame (with refresh) I would like to show the
progress bar.

My question: Has anybody done something like this with Struts before and can
give me some little advise? Or more specific: Is it possible to first get
the complete filesize from the FormFiles and the do the real Upload during
the Action (keeping track of the read bytes)

Thx for every help!!

___
Tim Adler, Abt. SDA1
Adress Management Solutions
AZ | Direct
Carl-Bertelsmann Straße 161s
D-33311 Gütersloh

Tel.: 05241/ 80 - 89574
[EMAIL PROTECTED]




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

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



Re: File-Upload: Progress-Bar

2004-03-19 Thread Joe Germuska
At 10:31 AM +0100 3/19/04, [EMAIL PROTECTED] wrote:
I'm up to the task to implement a progress bar for File-Uploads
...
My question: Has anybody done something like this with Struts before and can
give me some little advise?
I think someone is working on this, or at least has posted a bugzilla 
enhancement to commons-fileupload requesting it.  You might want to 
search the commons-dev mailing list archives or do a bugzilla search.

Joe

--
Joe Germuska
[EMAIL PROTECTED]  
http://blog.germuska.com
  Imagine if every Thursday your shoes exploded if you tied them 
the usual way.  This happens to us all the time with computers, and 
nobody thinks of complaining.
-- Jef Raskin

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


RE: File-Upload: Progress-Bar

2004-03-19 Thread JoAnn Lemm
I could tell you how I'm going it (I also have very large files to upload.)

1) Once the upload request comes in, I launch a thread from my action
class/servlet to handle the actual upload
2) I then forward to a page which displays a message indicating status.
3) I use java script to submit the status page so I can check on the
progress of the upload and prevent browser timeout. I set this submit for
every 10 secs.
4) Once I determine that the upload has completed, I forward back to my
upload jsp page (or wherever you need to go next.)

As for the size of the file ... that depends on whether or not the multipart
message contains the filesize.
--JoAnn 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 19, 2004 2:31 AM
To: [EMAIL PROTECTED]
Subject: File-Upload: Progress-Bar

Hello everybody!
 
I'm up to the task to implement a progress bar for File-Uploads, cause the
files that are uploaded to my Webapp can be quite large.
Well as usual this problem is not easily solved on the HTTP-Browser upload
side.
 
I'm using Struts here so I'm also using the commons/FileUpload. I was
planning to do it that way that I assign a unique number to every
session's-upload and keep the current status of an upload in a singleton for
access. In an additional frame (with refresh) I would like to show the
progress bar.
 
My question: Has anybody done something like this with Struts before and can
give me some little advise? Or more specific: Is it possible to first get
the complete filesize from the FormFiles and the do the real Upload during
the Action (keeping track of the read bytes)
 
Thx for every help!!

___
Tim Adler, Abt. SDA1
Adress Management Solutions
AZ | Direct
Carl-Bertelsmann Straße 161s
D-33311 Gütersloh

Tel.: 05241/ 80 - 89574
[EMAIL PROTECTED] 

 

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



Re: File-Upload: Progress-Bar

2004-03-19 Thread Michael McGrady
Check the archives.  There has been a lot on this.

At 01:31 AM 3/19/2004, you wrote:
Hello everybody!

I'm up to the task to implement a progress bar for File-Uploads, cause the
files that are uploaded to my Webapp can be quite large.
Well as usual this problem is not easily solved on the HTTP-Browser upload
side.
I'm using Struts here so I'm also using the commons/FileUpload. I was
planning to do it that way that I assign a unique number to every
session's-upload and keep the current status of an upload in a singleton for
access. In an additional frame (with refresh) I would like to show the
progress bar.
My question: Has anybody done something like this with Struts before and can
give me some little advise? Or more specific: Is it possible to first get
the complete filesize from the FormFiles and the do the real Upload during
the Action (keeping track of the read bytes)
Thx for every help!!

___
Tim Adler, Abt. SDA1
Adress Management Solutions
AZ | Direct
Carl-Bertelsmann Straße 161s
D-33311 Gütersloh
Tel.: 05241/ 80 - 89574
[EMAIL PROTECTED]



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


RE: File-Upload: Progress-Bar

2004-03-19 Thread Matthias Wessendorf
Hi Tim!

i didn't tryed it out,
but on ORA's ONJAVA
is saw an artikel on that
http://www.onjava.com/lpt/a/3886
perhaps you got some ideas on it!

Cheers, Matthias


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 19, 2004 10:31 AM
To: [EMAIL PROTECTED]
Subject: File-Upload: Progress-Bar


Hello everybody!
 
I'm up to the task to implement a progress bar for File-Uploads, cause
the files that are uploaded to my Webapp can be quite large. Well as
usual this problem is not easily solved on the HTTP-Browser upload side.
 
I'm using Struts here so I'm also using the commons/FileUpload. I was
planning to do it that way that I assign a unique number to every
session's-upload and keep the current status of an upload in a singleton
for access. In an additional frame (with refresh) I would like to show
the progress bar.
 
My question: Has anybody done something like this with Struts before and
can give me some little advise? Or more specific: Is it possible to
first get the complete filesize from the FormFiles and the do the real
Upload during the Action (keeping track of the read bytes)
 
Thx for every help!!

___
Tim Adler, Abt. SDA1
Adress Management Solutions
AZ | Direct
Carl-Bertelsmann Straße 161s
D-33311 Gütersloh

Tel.: 05241/ 80 - 89574
[EMAIL PROTECTED] 

 


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



Re: File-Upload: Progress-Bar

2004-03-19 Thread Martin Cooper

Joe Germuska [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 At 10:31 AM +0100 3/19/04, [EMAIL PROTECTED] wrote:
 I'm up to the task to implement a progress bar for File-Uploads
 ...
 My question: Has anybody done something like this with Struts before and
can
 give me some little advise?

 I think someone is working on this, or at least has posted a bugzilla
 enhancement to commons-fileupload requesting it.  You might want to
 search the commons-dev mailing list archives or do a bugzilla search.

Yes, there is an enhancement request open against Commons FileUpload for
this, complete with code:

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25830

Expect something along these lines in a forthcoming release of FileUpload,
with subsequent support in Struts.

--
Martin Cooper



 Joe

 -- 
 Joe Germuska
 [EMAIL PROTECTED]
 http://blog.germuska.com
Imagine if every Thursday your shoes exploded if you tied them
 the usual way.  This happens to us all the time with computers, and
 nobody thinks of complaining.
  -- Jef Raskin




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



RE: File-Upload: Progress-Bar : Mega Upload

2004-03-19 Thread Dhaliwal, Pritpal (HQP)
So I have never tried this..

But if someone can try it and let me know.. Check this out 
http://www.raditha.com/megaupload/jsp.php

Its progress bar thing that uses struts :)  Today when I was driving to
work.. I thought if a progress bar can be done using an applet.. :) ideas.
ideas.. ideas..

Pritpal Dhaliwal

-Original Message-
From: Martin Cooper [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 19, 2004 10:39 AM
To: [EMAIL PROTECTED]
Subject: Re: File-Upload: Progress-Bar



Joe Germuska [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 At 10:31 AM +0100 3/19/04, [EMAIL PROTECTED] wrote:
 I'm up to the task to implement a progress bar for File-Uploads ...
 My question: Has anybody done something like this with Struts before and
can
 give me some little advise?

 I think someone is working on this, or at least has posted a bugzilla 
 enhancement to commons-fileupload requesting it.  You might want to 
 search the commons-dev mailing list archives or do a bugzilla search.

Yes, there is an enhancement request open against Commons FileUpload for
this, complete with code:

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25830

Expect something along these lines in a forthcoming release of FileUpload,
with subsequent support in Struts.

--
Martin Cooper



 Joe

 --
 Joe Germuska
 [EMAIL PROTECTED]
 http://blog.germuska.com
Imagine if every Thursday your shoes exploded if you tied them
 the usual way.  This happens to us all the time with computers, and
 nobody thinks of complaining.
  -- Jef Raskin




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



Re: 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:

form-bean  name=linklibImportForm
  type=org.apache.struts.validator.DynaValidatorActionForm
  form-property name=bookmarksFile
type=org.apache.struts.upload.CommonsMultipartRequestHandler$CommonsFormFile/ 

/form-bean

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:
 
  form-bean  name=linklibImportForm
type=org.apache.struts.validator.DynaValidatorActionForm
form-property name=bookmarksFile
 
type=org.apache.struts.upload.CommonsMultipartRequestHandler$CommonsFormFil
e/
 
  /form-bean
 
  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
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:
form-bean  name=linklibImportForm
 type=org.apache.struts.validator.DynaValidatorActionForm
 form-property name=bookmarksFile
type=org.apache.struts.upload.CommonsMultipartRequestHandler$CommonsFormFil
e/
/form-bean

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:

form-bean  name=linklibImportForm
  type=org.apache.struts.validator.DynaValidatorActionForm
  form-property name=bookmarksFile
type=org.apache.struts.upload.CommonsMultipartRequestHandler$CommonsFormFile/
/form-bean
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[2]: File Upload and DynaActionForm?

2004-02-18 Thread Carl-Eric Menzel

 Did you change the form definition to
 enctype=multipart/form-data yet?

Yes, that is set correctly. Here's what it renders as HTML:
form name=pollForm method=post action=/mafo2-dev/editPollSubmit.do 
enctype=multipart/form-data id=theForm

Thanks
Carl-Eric
-- 
Carl-Eric Menzel * OpenPGP KeyID 808F4A8E * Encrypted Messages Preferred
| Advertising may be described as the science of arresting human  |
|  intelligence long enough to get money from it.   - Stephen Leacock |


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



Re[2]: File Upload and DynaActionForm?

2004-02-18 Thread Carl-Eric Menzel
 Hello Carl-Eric,
 What browser you used for testing?
 Opera have bug when upload field in form is null.

I'm using Mozilla Firefox and IE6, but this happens *before* the form
is even displayed. I'm only going to the page where it should show up,
and get the mentioned error message instead.

Thanks
Carl-Eric
-- 
Carl-Eric Menzel * OpenPGP KeyID 808F4A8E * Encrypted Messages Preferred
| Peace comes not from an absence of strife and conflict, but from|
|  our ability to cope with it. - Unknown |


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



Re: File Upload and DynaActionForm?

2004-02-18 Thread Robert McBride
I don't believe that DynaActionForm supports the 
org.apache.struts.upload.FormFile type.

See: 
http://jakarta.apache.org/struts/userGuide/building_controller.html#dyna_action_form_classes

-Rob

Carl-Eric Menzel wrote:

Hello,

I'm having trouble getting file upload working when using a DynaAction
form. Here are the relevant parts:
   form-bean
   name=pollForm
   type=org.apache.struts.action.DynaActionForm
   
   form-property name=active type=java.lang.Boolean/
   form-property name=name type=java.lang.String/
   form-property name=version type=java.lang.Integer/
   form-property name=pollid type=java.lang.Long/
   form-property name=owner type=java.lang.String/
   form-property name=ownerId type=java.lang.Long/
   form-property name=editorsToRemove type=java.lang.Long[]/
   form-property name=newEditorId type=java.lang.Long/
   form-property name=addressText type=java.lang.String/
   form-property name=introText type=java.lang.String/
   form-property name=endText type=java.lang.String/
   form-property name=fieldAddress1 type=java.lang.Integer/
   form-property name=fieldAddress2 type=java.lang.Integer/
   form-property name=fieldCell type=java.lang.Integer/
   form-property name=fieldCity type=java.lang.Integer/
   form-property name=fieldCountry type=java.lang.Integer/
   form-property name=fieldEmail type=java.lang.Integer/
   form-property name=fieldFirst type=java.lang.Integer/
   form-property name=fieldLast type=java.lang.Integer/
   form-property name=fieldPhone type=java.lang.Integer/
   form-property name=fieldState type=java.lang.Integer/
   form-property name=fieldZip type=java.lang.Integer/
   form-property name=destinationPgId type=java.lang.Long/
   form-property name=command type=java.lang.String/
   form-property name=commandParam type=java.lang.String/
   form-property name=locale type=java.lang.String/
   form-property name=theme type=java.lang.String/
   form-property name=futureContactText type=java.lang.String/
   form-property name=ticketRequired type=java.lang.Boolean/
   form-property name=tickets type=org.apache.struts.upload.FormFile/
   /form-bean
...and in the tile: html-el:file property=tickets/

It worked before, only without the file upload stuff - that is a new
addition. Now that I added this FormFile property, I get the following
from the tile:
[ServletException in:/pages/editor/editPoll.jsp] No getter method for property tickets 
of bean org.apache.struts.taglib.html.BEAN'
Any ideas on what I might be doing wrong?

Thanks
Carl-Eric
 



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


File Upload and DynaActionForm?

2004-02-17 Thread Carl-Eric Menzel

Hello,

I'm having trouble getting file upload working when using a DynaAction
form. Here are the relevant parts:

form-bean
name=pollForm
type=org.apache.struts.action.DynaActionForm

form-property name=active type=java.lang.Boolean/
form-property name=name type=java.lang.String/
form-property name=version type=java.lang.Integer/
form-property name=pollid type=java.lang.Long/
form-property name=owner type=java.lang.String/
form-property name=ownerId type=java.lang.Long/
form-property name=editorsToRemove type=java.lang.Long[]/
form-property name=newEditorId type=java.lang.Long/
form-property name=addressText type=java.lang.String/
form-property name=introText type=java.lang.String/
form-property name=endText type=java.lang.String/
form-property name=fieldAddress1 type=java.lang.Integer/
form-property name=fieldAddress2 type=java.lang.Integer/
form-property name=fieldCell type=java.lang.Integer/
form-property name=fieldCity type=java.lang.Integer/
form-property name=fieldCountry type=java.lang.Integer/
form-property name=fieldEmail type=java.lang.Integer/
form-property name=fieldFirst type=java.lang.Integer/
form-property name=fieldLast type=java.lang.Integer/
form-property name=fieldPhone type=java.lang.Integer/
form-property name=fieldState type=java.lang.Integer/
form-property name=fieldZip type=java.lang.Integer/
form-property name=destinationPgId type=java.lang.Long/
form-property name=command type=java.lang.String/
form-property name=commandParam type=java.lang.String/
form-property name=locale type=java.lang.String/
form-property name=theme type=java.lang.String/
form-property name=futureContactText type=java.lang.String/
form-property name=ticketRequired type=java.lang.Boolean/
form-property name=tickets type=org.apache.struts.upload.FormFile/
/form-bean

...and in the tile: html-el:file property=tickets/

It worked before, only without the file upload stuff - that is a new
addition. Now that I added this FormFile property, I get the following
from the tile:
[ServletException in:/pages/editor/editPoll.jsp] No getter method for property tickets 
of bean org.apache.struts.taglib.html.BEAN'

Any ideas on what I might be doing wrong?

Thanks
Carl-Eric
-- 
Carl-Eric Menzel * OpenPGP KeyID 808F4A8E * Encrypted Messages Preferred
| Of course, on the system *I* administrate, vi is symlinked to   |
|  ed. Emacs has been replaced by a shell script which 1) Generates a  |
|  syslogmessage at level LOG_EMERG; 2) reduces the user's disk quota  |
|  by 100K; and 3) RUNS ED! - Patrick J. LoPresti |


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



Re: File Upload and DynaActionForm?

2004-02-17 Thread Hubert Rabago

Did you change the form definition to enctype=multipart/form-data yet?

--- Carl-Eric Menzel [EMAIL PROTECTED] wrote:
 
 Hello,
 
 I'm having trouble getting file upload working when using a DynaAction
 form. Here are the relevant parts:
 
 form-bean
 name=pollForm
 type=org.apache.struts.action.DynaActionForm
 
 form-property name=active type=java.lang.Boolean/
 form-property name=name type=java.lang.String/
 form-property name=version type=java.lang.Integer/
 form-property name=pollid type=java.lang.Long/
 form-property name=owner type=java.lang.String/
 form-property name=ownerId type=java.lang.Long/
 form-property name=editorsToRemove type=java.lang.Long[]/
 form-property name=newEditorId type=java.lang.Long/
 form-property name=addressText type=java.lang.String/
 form-property name=introText type=java.lang.String/
 form-property name=endText type=java.lang.String/
 form-property name=fieldAddress1 type=java.lang.Integer/
 form-property name=fieldAddress2 type=java.lang.Integer/
 form-property name=fieldCell type=java.lang.Integer/
 form-property name=fieldCity type=java.lang.Integer/
 form-property name=fieldCountry type=java.lang.Integer/
 form-property name=fieldEmail type=java.lang.Integer/
 form-property name=fieldFirst type=java.lang.Integer/
 form-property name=fieldLast type=java.lang.Integer/
 form-property name=fieldPhone type=java.lang.Integer/
 form-property name=fieldState type=java.lang.Integer/
 form-property name=fieldZip type=java.lang.Integer/
 form-property name=destinationPgId type=java.lang.Long/
 form-property name=command type=java.lang.String/
 form-property name=commandParam type=java.lang.String/
 form-property name=locale type=java.lang.String/
 form-property name=theme type=java.lang.String/
 form-property name=futureContactText
 type=java.lang.String/
 form-property name=ticketRequired type=java.lang.Boolean/
 form-property name=tickets
 type=org.apache.struts.upload.FormFile/
 /form-bean
 
 ...and in the tile: html-el:file property=tickets/
 
 It worked before, only without the file upload stuff - that is a new
 addition. Now that I added this FormFile property, I get the following
 from the tile:
 [ServletException in:/pages/editor/editPoll.jsp] No getter method for
 property tickets of bean org.apache.struts.taglib.html.BEAN'
 
 Any ideas on what I might be doing wrong?
 
 Thanks
 Carl-Eric
 -- 
 Carl-Eric Menzel * OpenPGP KeyID 808F4A8E * Encrypted Messages Preferred
 | Of course, on the system *I* administrate, vi is symlinked to   |
 |  ed. Emacs has been replaced by a shell script which 1) Generates a  |
 |  syslogmessage at level LOG_EMERG; 2) reduces the user's disk quota  |
 |  by 100K; and 3) RUNS ED! - Patrick J. LoPresti |
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

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



Re: File Upload and DynaActionForm?

2004-02-17 Thread A3T
Hello Carl-Eric,
What browser you used for testing?
Opera have bug when upload field in form is null.

Wednesday, February 18, 2004, 5:45:24 AM, you wrote:


CEM Hello,

CEM I'm having trouble getting file upload working when using a DynaAction
CEM form. Here are the relevant parts:

CEM form-bean
CEM name=pollForm
CEM type=org.apache.struts.action.DynaActionForm
CEM 
CEM form-property name=active type=java.lang.Boolean/
CEM form-property name=name type=java.lang.String/
CEM form-property name=version type=java.lang.Integer/
CEM form-property name=pollid type=java.lang.Long/
CEM form-property name=owner type=java.lang.String/
CEM form-property name=ownerId type=java.lang.Long/
CEM form-property name=editorsToRemove type=java.lang.Long[]/
CEM form-property name=newEditorId type=java.lang.Long/
CEM form-property name=addressText type=java.lang.String/
CEM form-property name=introText type=java.lang.String/
CEM form-property name=endText type=java.lang.String/
CEM form-property name=fieldAddress1 type=java.lang.Integer/
CEM form-property name=fieldAddress2 type=java.lang.Integer/
CEM form-property name=fieldCell type=java.lang.Integer/
CEM form-property name=fieldCity type=java.lang.Integer/
CEM form-property name=fieldCountry type=java.lang.Integer/
CEM form-property name=fieldEmail type=java.lang.Integer/
CEM form-property name=fieldFirst type=java.lang.Integer/
CEM form-property name=fieldLast type=java.lang.Integer/
CEM form-property name=fieldPhone type=java.lang.Integer/
CEM form-property name=fieldState type=java.lang.Integer/
CEM form-property name=fieldZip type=java.lang.Integer/
CEM form-property name=destinationPgId type=java.lang.Long/
CEM form-property name=command type=java.lang.String/
CEM form-property name=commandParam type=java.lang.String/
CEM form-property name=locale type=java.lang.String/
CEM form-property name=theme type=java.lang.String/
CEM form-property name=futureContactText type=java.lang.String/
CEM form-property name=ticketRequired type=java.lang.Boolean/
CEM form-property name=tickets
CEM type=org.apache.struts.upload.FormFile/
CEM /form-bean

CEM ...and in the tile: html-el:file property=tickets/

CEM It worked before, only without the file upload stuff - that is a new
CEM addition. Now that I added this FormFile property, I get the following
CEM from the tile:
CEM [ServletException in:/pages/editor/editPoll.jsp] No getter
CEM method for property tickets of bean
CEM org.apache.struts.taglib.html.BEAN'

CEM Any ideas on what I might be doing wrong?

CEM Thanks
CEM Carl-Eric



-- 
Best regards,
 A3Tmailto:[EMAIL PROTECTED]


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



File Upload using Struts

2004-02-03 Thread Gandhi, Snehal Kishore (Cognizant)



Hi 
all,
 i'm a new bee of 
struts...
 i want to use the Struts based 
upload option. 
1. What 
should be the data type in my ActionForm?
2. How will 
i get the FileObject in my action class?
and How can 
i pass the file to the Server?
4. if any 
sample upload code using struts would be really very 
helpful?
thanx in 
advance..
--Snehal 


-- Snehal K. Gandhi | Email 
: [EMAIL PROTECTED]Financial Services Group| http://www.cognizant.comCognizant 
Corporation | Ph:91-44-52096000 Mobile : +91 98400 57326 | Xtn:8118, Vnet:48128 
-- The secret to enjoying your job is 
not to change your job but to change your attitude..

This e-mail and any files transmitted with it are for the sole use of the intended 
recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply e-mail and 
destroy all copies of the original message. 
Any unauthorised review, use, disclosure, dissemination, forwarding, printing or 
copying of this email or any action taken in reliance on this e-mail is strictly 
prohibited and may be unlawful.

Visit us at http://www.cognizant.com

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

RE: File Upload using Struts

2004-02-03 Thread Manjunath Bhat
The struts1.1 distribution contains a file
jakarta-struts-1.1\webapps\struts-upload.war. This will answer all your
queries.
 
Manjunath/
 
-Original Message-
From: Gandhi, Snehal Kishore (Cognizant)
[mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 03, 2004 5:21 PM
To: [EMAIL PROTECTED]
Subject: File Upload using Struts
 
Hi all,
i'm a new bee of struts...
i want to use the Struts based upload option. 
1. What should be the data type in my ActionForm?
2. How will i get the FileObject in my action class?
and How can i pass the file to the Server?
4. if any sample upload code using struts would be really very helpful?
thanx in advance..
--Snehal
 
-- 
Snehal K. Gandhi | Email : [EMAIL PROTECTED] 
Financial Services Group | http://www.cognizant.com
http://www.cognizant.com/  
Cognizant Corporation| Ph:91-44-52096000 
Mobile : +91 98400 57326 | Xtn:8118, Vnet:48128 
 -- The secret to enjoying your job is not to change your job but to
change your attitude..
 


? File Upload bug for uploading files with French Character

2004-01-07 Thread Saul Q Yuan
Hi,
 
I am trying to upload files with French characters, but all the French
characters are replaced as ? in the file. The enviroment is:
Tomcat4.0.3, Linux. I wonder if this is a bug with the version of
Tomcat4.0.3 for Linux. 
 
thanks advance for any help.
 
 
Saul 


Re: Still having problems with File upload (multipart-formdata)

2003-12-30 Thread Patrick Scheuerer
Brice Ruth wrote:

I'm refactoring (so to speak) my currently working form, which accepts 
an image to be uploaded, to use a DynaValidator(Action?)Form and I'm 
again running into an exception being thrown:
Hi Brice,
I'm also struggling with file uploads at the moment. But I'm stuck at an earlier 
stage than you.
Could you please post some of your code on how to handle the file upload in the 
action class?
I'm having problems to figure out how to write the file to a subdirectory of my 
web application root.

Your help would be highly appreciated!
Thank you, Patrick
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Still having problems with File upload (multipart-formdata)

2003-12-30 Thread Matthias Wessendorf
Hi Patrick,

you want to get the path of /myapp 
like C:\Tomcat\webapps\myapp
or?

that is done with:

String placeString = 
getServlet().getServletContext().getRealPath(/);

in an actionClass.

you now want to store
in placeString\uploaddir
isn´t it?

i wrote an Util-Class which managed the
storage in my action.
one parameter is the formfile the other the placeToStore.
you can get it, if you want...



-Original Message-
From: Patrick Scheuerer [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 30, 2003 1:12 PM
To: Struts Users Mailing List
Subject: Re: Still having problems with File upload (multipart-formdata)


Brice Ruth wrote:

 I'm refactoring (so to speak) my currently working form, which accepts
 an image to be uploaded, to use a DynaValidator(Action?)Form and I'm 
 again running into an exception being thrown:

Hi Brice,
I'm also struggling with file uploads at the moment. But I'm stuck at an
earlier 
stage than you.
Could you please post some of your code on how to handle the file upload
in the 
action class?
I'm having problems to figure out how to write the file to a
subdirectory of my 
web application root.

Your help would be highly appreciated!
Thank you, Patrick


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


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



Re: Still having problems with File upload (multipart-formdata)

2003-12-30 Thread Brice Ruth
Martin Cooper wrote:

Brice Ruth [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 

I'm refactoring (so to speak) my currently working form, which accepts
an image to be uploaded, to use a DynaValidator(Action?)Form and I'm
again running into an exception being thrown:
java.lang.NoClassDefFoundError:
org/apache/commons/fileupload/FileUploadBase$SizeLimitExceededException
   

This usually happens when your container has another copy of (a different
version of) the Commons FileUpload jar file, and you are not putting all of
your application's jar files in your WEB-INF/lib directory, so that the
wrong jar file is being loaded. Just make sure that your web app is
self-contained and you should be fine.
 

Damn, I tracked this down last time, made sure all the JARs were the 
same version, and somehow a different version has crept in again ... 
Jeesh!! I'll have to track down through CVS how this happened ...

--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Still having problems with File upload (multipart-formdata)

2003-12-30 Thread Patrick Scheuerer
Matthias Wessendorf wrote:

Hi Patrick,

you want to get the path of /myapp 
like C:\Tomcat\webapps\myapp
or?
That's exactly what i was trying to do!

in an actionClass
you now want to store
in placeString\uploaddir
isn´t it?
Right again :-)

i wrote an Util-Class which managed the
storage in my action.
one parameter is the formfile the other the placeToStore.
you can get it, if you want...
That would be wonderful! Thank you very much for your help!

Patrick

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


RE: Still having problems with File upload (multipart-formdata)

2003-12-30 Thread Matthias Wessendorf
Hi Patrick,
okay attched is my class

it offers only two methods.
soon more... perhaps ;-)

one stores a form-file to a place, defined in a PROPERTIES-File
under uploadPath-KEY

the other stores the file to a place which is the second-parameter ;-)

both methods are static. The class has only a private Construktor,
so it is final... :-)



With

String placeString = 
getServlet().getServletContext().getRealPath(/);

you get the Path of your Struts-App
like: C:\Tomcat\webapps\myStrutsApp


so you could use the second like:

UploadFile.saveFile(myFormFile, placeString);

your file is then in root.

hope this is what you needed.

greetings

matthias

-Original Message-
From: Patrick Scheuerer [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 30, 2003 5:15 PM
To: Struts Users Mailing List
Subject: Re: Still having problems with File upload (multipart-formdata)


Matthias Wessendorf wrote:

 Hi Patrick,
 
 you want to get the path of /myapp
 like C:\Tomcat\webapps\myapp
 or?

That's exactly what i was trying to do!

 in an actionClass
 you now want to store
 in placeString\uploaddir
 isn´t it?

Right again :-)

 i wrote an Util-Class which managed the
 storage in my action.
 one parameter is the formfile the other the placeToStore.
 you can get it, if you want...

That would be wonderful! Thank you very much for your help!

Patrick


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

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

Re: Still having problems with File upload (multipart-formdata)

2003-12-30 Thread David Erickson
construktor ;P

- Original Message - 
From: Matthias Wessendorf [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Tuesday, December 30, 2003 9:29 AM
Subject: RE: Still having problems with File upload (multipart-formdata)


Hi Patrick,
okay attched is my class

it offers only two methods.
soon more... perhaps ;-)

one stores a form-file to a place, defined in a PROPERTIES-File
under uploadPath-KEY

the other stores the file to a place which is the second-parameter ;-)

both methods are static. The class has only a private Construktor,
so it is final... :-)



With

String placeString =
getServlet().getServletContext().getRealPath(/);

you get the Path of your Struts-App
like: C:\Tomcat\webapps\myStrutsApp


so you could use the second like:

UploadFile.saveFile(myFormFile, placeString);

your file is then in root.

hope this is what you needed.

greetings

matthias

-Original Message-
From: Patrick Scheuerer [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 30, 2003 5:15 PM
To: Struts Users Mailing List
Subject: Re: Still having problems with File upload (multipart-formdata)


Matthias Wessendorf wrote:

 Hi Patrick,

 you want to get the path of /myapp
 like C:\Tomcat\webapps\myapp
 or?

That's exactly what i was trying to do!

 in an actionClass
 you now want to store
 in placeString\uploaddir
 isn´t it?

Right again :-)

 i wrote an Util-Class which managed the
 storage in my action.
 one parameter is the formfile the other the placeToStore.
 you can get it, if you want...

That would be wonderful! Thank you very much for your help!

Patrick


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








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


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



RE: Still having problems with File upload (multipart-formdata)

2003-12-30 Thread Matthias Wessendorf
and nothing attched:


so see below

Greetings matthias

---
package net.wessendorf.utils.file;

import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Properties;

import org.apache.struts.upload.FormFile;

/**
 * Hilfsklasse, mit welcher aus einer Web-Anwendung
 * Daten zum Web-Server geladen werden können.
 *
 * @author Matthias Wessendorf
 */
public final class UploadFile {

/**
 * 
 * Private Constructor, prevents the class for beeing
 * instanced.
 * 
 *
 */
private UploadFile() {

}

/**
 * 
 * Save a Jakarta FormFile to a preconfigured place.
 * 
 * @param file
 * @return
 */
public static String saveFile(FormFile file){
String retVal = null;

try {
//retrieve the file data
ByteArrayOutputStream baos = new
ByteArrayOutputStream();
InputStream stream = file.getInputStream();
Properties props = new Properties();

//properties must exist

props.load(Thread.currentThread().getContextClassLoader().getResourceAsS
tream(ecards.properties));
String place= props.getProperty(uploadPath);

if(!place.endsWith(/))
place = new
StringBuffer(place).insert(place.length(),/).toString();
retVal = place+file.getFileName();

//write the file to the file specified
OutputStream bos = new FileOutputStream(retVal);
int bytesRead = 0;
byte[] buffer = file.getFileData();
while ((bytesRead = stream.read(buffer)) != -1)
{
bos.write(buffer, 0, bytesRead);
}
bos.close();

//close the stream
stream.close();
}
catch (FileNotFoundException fnfe) {
System.out.println(Datei nicht vorhanden);
fnfe.printStackTrace();
}
catch (IOException ioe) {
ioe.printStackTrace();
}



return retVal;
}

/**
 * 
 * Saves a Jakarta FormFile to a desired place.
 * 
 * @param file - the FormFile to store
 * @param place - the desired place for the file
 * @return place of file
 */
public static String saveFile(FormFile file, String place) {
String retVal = null;

try {
//retrieve the file data
ByteArrayOutputStream baos = new
ByteArrayOutputStream();
InputStream stream = file.getInputStream();

if(!place.endsWith(/))
place = new
StringBuffer(place).insert(place.length(),/).toString();

retVal = place+file.getFileName();

//write the file to the file specified
OutputStream bos = new FileOutputStream(retVal);
int bytesRead = 0;
byte[] buffer = file.getFileData();
while ((bytesRead = stream.read(buffer)) != -1)
{
bos.write(buffer, 0, bytesRead);
}
bos.close();

//close the stream
stream.close();
}
catch (FileNotFoundException fnfe) {
System.out.println(File not found);
fnfe.printStackTrace();
}
catch (IOException ioe) {
ioe.printStackTrace();
}



return retVal;
}
}



-Original Message-
From: David Erickson [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 30, 2003 5:37 PM
To: Struts Users Mailing List
Subject: Re: Still having problems with File upload (multipart-formdata)


construktor ;P

- Original Message - 
From: Matthias Wessendorf [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Tuesday, December 30, 2003 9:29 AM
Subject: RE: Still having problems with File upload (multipart-formdata)


Hi Patrick,
okay attched

Re: Still having problems with File upload (multipart-formdata)

2003-12-30 Thread Patrick Scheuerer
This is exactly what i was looking for! Thank you very much for your help Matthias.

Patrick

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


Re: Still having problems with File upload (multipart-formdata)

2003-12-30 Thread Craig R. McClanahan
Quoting Patrick Scheuerer [EMAIL PROTECTED]:

 Matthias Wessendorf wrote:
 
  Hi Patrick,
  
  you want to get the path of /myapp 
  like C:\Tomcat\webapps\myapp
  or?
 
 That's exactly what i was trying to do!
 
  in an actionClass
  you now want to store
  in placeString\uploaddir
  isn´t it?
 
 Right again :-)
 
  i wrote an Util-Class which managed the
  storage in my action.
  one parameter is the formfile the other the placeToStore.
  you can get it, if you want...
 
 That would be wonderful! Thank you very much for your help!
 

I would also offer a couple of cautions about this approach:

* You are not guaranteed that a particular servlet container
  even *has* a concept of a directory in which the web app
  is deployed -- for example, even Tomcat can execute a webapp
  directly from the WAR file.  When you do that, getRealPath()
  returns null instead of a pathname, and your calculations above
  will trigger a NullPointerException.

* Even when you know that your apps are being deployed in unpacked
  directories, uploading things directly into that directory means
  you have to be careful about redeployment when you update the app
  -- the normal behavior of delete the old directory and replace it
  with the new app wipes out any uploaded files.

I would recommend defining a directory somewhere in your server to hold the
uploaded files for a webapp, and then pass the pathname of this directory to
your app as a context init parameter or something like that.  This approach
deals with both of the problems identified above.

 Patrick
 

Craig


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



File Upload Validator

2003-12-29 Thread Patrick Scheuerer
Hi,

I have to validate a form which collects all the data connected with a 
document. Allong with discriptive information there's also a html:file 
element to upload the file itself. So far use a DynaValidatorForm to do 
validation. Everything works fine for the text based form elements. I 
would also like to validate the file (FormFile) for size (it shouldn't 
be bigger than e.g. 1 MB)  and MIME type (pdf, doc, exe, zip, etc.). Is 
there any extension for the Validator framework that can accomplish this?
Of course I could write my own validator class, I'm just curious if 
something like this has been done already and is a readily available.

Thanks, Patrick

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


RE: File Upload Validator

2003-12-29 Thread Matthias Wessendorf
hi,

use controller maxFileSize=1M/

set this in struts-config for maxFileSize.

look at file-upload-sample in your struts-distribution
There cames an error, if the file is bigger.

greetings

matthias


-Original Message-
From: Patrick Scheuerer [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 29, 2003 5:34 PM
To: Struts Users List
Subject: File Upload Validator


Hi,

I have to validate a form which collects all the data connected with a 
document. Allong with discriptive information there's also a html:file

element to upload the file itself. So far use a DynaValidatorForm to do 
validation. Everything works fine for the text based form elements. I 
would also like to validate the file (FormFile) for size (it shouldn't 
be bigger than e.g. 1 MB)  and MIME type (pdf, doc, exe, zip, etc.). Is 
there any extension for the Validator framework that can accomplish
this? Of course I could write my own validator class, I'm just curious
if 
something like this has been done already and is a readily available.

Thanks, Patrick


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


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



Still having problems with File upload (multipart-formdata)

2003-12-29 Thread Brice Ruth
I'm refactoring (so to speak) my currently working form, which accepts 
an image to be uploaded, to use a DynaValidator(Action?)Form and I'm 
again running into an exception being thrown:

java.lang.NoClassDefFoundError: 
org/apache/commons/fileupload/FileUploadBase$SizeLimitExceededException

What's going on here?! Also, to get more mileage out of this post, what 
exactly is the difference between a DynaValidatorForm and a 
DynaValidatorActionForm?!

--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Still having problems with File upload (multipart-formdata)

2003-12-29 Thread Martin Cooper

Brice Ruth [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I'm refactoring (so to speak) my currently working form, which accepts
 an image to be uploaded, to use a DynaValidator(Action?)Form and I'm
 again running into an exception being thrown:

 java.lang.NoClassDefFoundError:
 org/apache/commons/fileupload/FileUploadBase$SizeLimitExceededException

This usually happens when your container has another copy of (a different
version of) the Commons FileUpload jar file, and you are not putting all of
your application's jar files in your WEB-INF/lib directory, so that the
wrong jar file is being loaded. Just make sure that your web app is
self-contained and you should be fine.


 What's going on here?! Also, to get more mileage out of this post, what
 exactly is the difference between a DynaValidatorForm and a
 DynaValidatorActionForm?!

I believe the only difference is in the key passed to the Validator. The
former uses the value of the 'name' attribute from struts-config.xml, while
the latter uses the value of the 'path' attribute. (But no, I don't know
when you would choose one over the other. ;)

--
Martin Cooper



 -- 
 Brice D. Ruth
 Sr. IT Analyst
 Fiskars Brands, Inc.




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



File Upload Problems

2003-12-29 Thread Patrick Scheuerer
Hi,

I was just looking at the struts-upload application... why is the file uploaded 
to %TOMCAT_HOME%/bin ?

What i would like to do is to save the uploaded file in a subdirectory of the 
root of the application (%TOMCAT_HOME%/webapps/myapp/uploaddir). The saving 
location is determined on a the file category chosen in the file upload form.

Another thing I don't know is, how I can retrieve the base path of my web 
application.

I tried something like this:
String savingLocation = new String(
 request.getContextPath()
+ /data/
+ category.getPath() + /
+ fileName);
Then I create a File with this path as in:
File tempFile = new File(savePath);
If i read the absolute path of the tempFile:
String absPath = tempFile.getAbsolutePath();
i get the following:
C:\myapp\data\tests\uploadedFile.txt
where
- myapp is the name of the application
- tests is the path name for this category supplied in the form
- uploadedFile.txt is the uploaded file :-)
Any tips, suggestions and examples would be highly appreciated.

Thanks, Patrick

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


Re: File Upload

2003-12-26 Thread Martin Cooper
What is it that you are trying to do? Is there a reason you can't just use a
FormFile object in your form bean? That would make your life a whole lot
easier - you wouldn't have to know or care about the request wrapper, and
you wouldn't have to iterate over the uploaded fields.

Also, I'm not sure where you're getting what you're trying to use in the
code you posted. Are you trying to write a Struts app or a WebWork app?
ServletActionContext is a WebWork class, not a Struts class, and
getFileNames() and getFilesystemName() are WebWork methods as well, and not
available on the Struts MultipartRequestWrapper class.

Something is very wrong...

--
Martin Cooper


Jacob Ginu [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 This is the sample code I am using in the action.java file.I have the
necessary struts file.But it says Unable to find ServletActionContext in
MultipartRequestWrapper when compiled.

 MultipartRequestWrapper multiWrapper =
 (MultipartRequestWrapper)
 ServletActionContext.getRequest();

 Enumeration e = multiWrapper.getFileNames();
 while(e.hasMoreElements()) {
// get the value of thisinput tag
StringinputValue = (String) e.nextElement();
 // get the content type
StringcontentType = multiWrapper.getContentType(inputValue);
 // get the name of the file from the input tag
StringfileName = multiWrapper.getFilesystemName(inputValue);
 // Get a File object forthe uploaded File
File file = multiWrapper.getFile(inputValue);
 // If it's nullthe upload failed
if(file == null) {
   addActionError(Error uploading: +
 multiWrapper.getFilesystemName(inputValue));
}


 David Friedman [EMAIL PROTECTED] wrote:
 Why won't you use the struts-upload.war from the Struts distributions?

 Regards,
 David

 -Original Message-
 From: Jacob Ginu [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, December 23, 2003 9:48 PM
 To: [EMAIL PROTECTED]
 Subject: reg:File Upload

 Hi,

 Can anyone send me a sample file Upload program.

 Regards,
 Ginu

 -
 Do you Yahoo!?
 Yahoo! Photos - Get your photo on the big screen in Times Square


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


 -
 Do you Yahoo!?
 Yahoo! Photos - Get your photo on the big screen in Times Square




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



RE: File Upload

2003-12-25 Thread David Friedman
Jacob,

Did anyone ever get back to you on this? Where are you trying to get your
MultiPartRequestWrapper?

In an ActionForm subclass, you can use the method:
getMultipartRequestHandler()

In an Action subclass, you can do pull it from above using:
MultipartRequestWrapper multiWrapper = (MultipartRequestWrapper)
form.getMultipartRequestHandler();

OR, if there is no ActionForm defined for your Action subclass, create a new
type of MultipartRequestHandler such as:

CommonsMultipartRequestHandler cmrh = new CommonsMultipartRequestHandler();
cmrh.setServlet(servlet);
cmrh.handleRequest(request);
HashTable h = cmrh.getFileElements();

I used CommonsMultipartRequestHandler in my example (from an old post) but
any appropriate MultiPartRequestHandler subclass should work.
http://www.mail-archive.com/[EMAIL PROTECTED]/msg87269.html

Just remember 2 things:
a) only one file can be uploaded per file input field - someone tried to
list many files in one upload field and kept seeing Exceptions thrown.

b) if you are not using an ActionForm, there doesn't appear to be a
MultiPartRequestHandler initialized, so create a new one like #2 above.

Regards,
David

-Original Message-
From: Jacob Ginu [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 23, 2003 10:03 PM
To: Struts Users Mailing List
Subject: RE: File Upload


Hi,

This is the sample code I am using in the action.java file.I have the
necessary struts file.But it says Unable to find ServletActionContext in
MultipartRequestWrapper when compiled.

MultipartRequestWrapper multiWrapper =
(MultipartRequestWrapper)
ServletActionContext.getRequest();

Enumeration e = multiWrapper.getFileNames();
while(e.hasMoreElements()) {
   // get the value of thisinput tag
   StringinputValue = (String) e.nextElement();
// get the content type
   StringcontentType = multiWrapper.getContentType(inputValue);
// get the name of the file from the input tag
   StringfileName = multiWrapper.getFilesystemName(inputValue);
// Get a File object forthe uploaded File
   File file = multiWrapper.getFile(inputValue);
// If it's nullthe upload failed
   if(file == null) {
  addActionError(Error uploading: +
multiWrapper.getFilesystemName(inputValue));
   }


David Friedman [EMAIL PROTECTED] wrote:
Why won't you use the struts-upload.war from the Struts distributions?

Regards,
David

-Original Message-
From: Jacob Ginu [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 23, 2003 9:48 PM
To: [EMAIL PROTECTED]
Subject: reg:File Upload

Hi,

Can anyone send me a sample file Upload program.

Regards,
Ginu

-
Do you Yahoo!?
Yahoo! Photos - Get your photo on the big screen in Times Square


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


-
Do you Yahoo!?
Yahoo! Photos - Get your photo on the big screen in Times Square


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



RE: File Upload

2003-12-25 Thread Jacob Ginu
David,
No one has got back to me on this except you.There seems to be not much info regarding 
this.Iam going throught the link you sent me.
I tried to call MultipartRequestWrapper from an action subclass.I was not successful 
in it.
 
Thanx for your response.
 
Regards,
Ginu Jacob
David Friedman [EMAIL PROTECTED] wrote:
Jacob,

Did anyone ever get back to you on this? Where are you trying to get your
MultiPartRequestWrapper?

In an ActionForm subclass, you can use the method:
getMultipartRequestHandler()

In an Action subclass, you can do pull it from above using:
MultipartRequestWrapper multiWrapper = (MultipartRequestWrapper)
form.getMultipartRequestHandler();

OR, if there is no ActionForm defined for your Action subclass, create a new
type of MultipartRequestHandler such as:

CommonsMultipartRequestHandler cmrh = new CommonsMultipartRequestHandler();
cmrh.setServlet(servlet);
cmrh.handleRequest(request);
HashTable h = cmrh.getFileElements();

I used CommonsMultipartRequestHandler in my example (from an old post) but
any appropriate MultiPartRequestHandler subclass should work.
http://www.mail-archive.com/[EMAIL PROTECTED]/msg87269.html

Just remember 2 things:
a) only one file can be uploaded per file input field - someone tried to
list many files in one upload field and kept seeing Exceptions thrown.

b) if you are not using an ActionForm, there doesn't appear to be a
MultiPartRequestHandler initialized, so create a new one like #2 above.

Regards,
David

-Original Message-
From: Jacob Ginu [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 23, 2003 10:03 PM
To: Struts Users Mailing List
Subject: RE: File Upload


Hi,

This is the sample code I am using in the action.java file.I have the
necessary struts file.But it says Unable to find ServletActionContext in
MultipartRequestWrapper when compiled.

MultipartRequestWrapper multiWrapper =
(MultipartRequestWrapper)
ServletActionContext.getRequest();

Enumeration e = multiWrapper.getFileNames();
while(e.hasMoreElements()) {
// get the value of thisinput tag
StringinputValue = (String) e.nextElement();
// get the content type
StringcontentType = multiWrapper.getContentType(inputValue);
// get the name of the file from the input tag
StringfileName = multiWrapper.getFilesystemName(inputValue);
// Get a File object forthe uploaded File
File file = multiWrapper.getFile(inputValue);
// If it's nullthe upload failed
if(file == null) {
addActionError(Error uploading: +
multiWrapper.getFilesystemName(inputValue));
}


David Friedman wrote:
Why won't you use the struts-upload.war from the Struts distributions?

Regards,
David

-Original Message-
From: Jacob Ginu [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 23, 2003 9:48 PM
To: [EMAIL PROTECTED]
Subject: reg:File Upload

Hi,

Can anyone send me a sample file Upload program.

Regards,
Ginu

-
Do you Yahoo!?
Yahoo! Photos - Get your photo on the big screen in Times Square


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


-
Do you Yahoo!?
Yahoo! Photos - Get your photo on the big screen in Times Square


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


-
Do you Yahoo!?
Yahoo! Photos - Get your photo on the big screen in Times Square

RE: File Upload

2003-12-25 Thread David Friedman
Jacob,

That post was all from working examples I had while looking into the problem
(I was curious when I read the original post back then).  Let me know if I
can assist you with anything. Feel free to post your ActionForm and Action
subclasses for assistance.

Regards,
David

-Original Message-
From: Jacob Ginu [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 25, 2003 9:30 PM
To: Struts Users Mailing List
Subject: RE: File Upload


David,
No one has got back to me on this except you.There seems to be not much info
regarding this.Iam going throught the link you sent me.
I tried to call MultipartRequestWrapper from an action subclass.I was not
successful in it.

Thanx for your response.

Regards,
Ginu Jacob
David Friedman [EMAIL PROTECTED] wrote:
Jacob,

Did anyone ever get back to you on this? Where are you trying to get your
MultiPartRequestWrapper?

In an ActionForm subclass, you can use the method:
getMultipartRequestHandler()

In an Action subclass, you can do pull it from above using:
MultipartRequestWrapper multiWrapper = (MultipartRequestWrapper)
form.getMultipartRequestHandler();

OR, if there is no ActionForm defined for your Action subclass, create a new
type of MultipartRequestHandler such as:

CommonsMultipartRequestHandler cmrh = new CommonsMultipartRequestHandler();
cmrh.setServlet(servlet);
cmrh.handleRequest(request);
HashTable h = cmrh.getFileElements();

I used CommonsMultipartRequestHandler in my example (from an old post) but
any appropriate MultiPartRequestHandler subclass should work.
http://www.mail-archive.com/[EMAIL PROTECTED]/msg87269.html

Just remember 2 things:
a) only one file can be uploaded per file input field - someone tried to
list many files in one upload field and kept seeing Exceptions thrown.

b) if you are not using an ActionForm, there doesn't appear to be a
MultiPartRequestHandler initialized, so create a new one like #2 above.

Regards,
David

-Original Message-
From: Jacob Ginu [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 23, 2003 10:03 PM
To: Struts Users Mailing List
Subject: RE: File Upload


Hi,

This is the sample code I am using in the action.java file.I have the
necessary struts file.But it says Unable to find ServletActionContext in
MultipartRequestWrapper when compiled.

MultipartRequestWrapper multiWrapper =
(MultipartRequestWrapper)
ServletActionContext.getRequest();

Enumeration e = multiWrapper.getFileNames();
while(e.hasMoreElements()) {
// get the value of thisinput tag
StringinputValue = (String) e.nextElement();
// get the content type
StringcontentType = multiWrapper.getContentType(inputValue);
// get the name of the file from the input tag
StringfileName = multiWrapper.getFilesystemName(inputValue);
// Get a File object forthe uploaded File
File file = multiWrapper.getFile(inputValue);
// If it's nullthe upload failed
if(file == null) {
addActionError(Error uploading: +
multiWrapper.getFilesystemName(inputValue));
}


David Friedman wrote:
Why won't you use the struts-upload.war from the Struts distributions?

Regards,
David

-Original Message-
From: Jacob Ginu [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 23, 2003 9:48 PM
To: [EMAIL PROTECTED]
Subject: reg:File Upload

Hi,

Can anyone send me a sample file Upload program.

Regards,
Ginu

-
Do you Yahoo!?
Yahoo! Photos - Get your photo on the big screen in Times Square


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


-
Do you Yahoo!?
Yahoo! Photos - Get your photo on the big screen in Times Square


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


-
Do you Yahoo!?
Yahoo! Photos - Get your photo on the big screen in Times Square


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



RE: File Upload

2003-12-23 Thread David Friedman
Why won't you use the struts-upload.war from the Struts distributions?

Regards,
David

-Original Message-
From: Jacob Ginu [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 23, 2003 9:48 PM
To: [EMAIL PROTECTED]
Subject: reg:File Upload

Hi,
 
Can anyone send me a sample file Upload program.
 
Regards,
Ginu

-
Do you Yahoo!?
Yahoo! Photos - Get your photo on the big screen in Times Square


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



RE: File Upload

2003-12-23 Thread Jacob Ginu
Hi,
 
This is the sample code I am using in the action.java file.I have the necessary struts 
file.But it says Unable to find ServletActionContext in MultipartRequestWrapper when 
compiled.
 
MultipartRequestWrapper multiWrapper =
(MultipartRequestWrapper) 
ServletActionContext.getRequest();

Enumeration e = multiWrapper.getFileNames();
while(e.hasMoreElements()) {
   // get the value of thisinput tag
   StringinputValue = (String) e.nextElement();
// get the content type
   StringcontentType = multiWrapper.getContentType(inputValue);
// get the name of the file from the input tag
   StringfileName = multiWrapper.getFilesystemName(inputValue);
// Get a File object forthe uploaded File
   File file = multiWrapper.getFile(inputValue);
// If it's nullthe upload failed
   if(file == null) {
  addActionError(Error uploading: +
multiWrapper.getFilesystemName(inputValue));
   }


David Friedman [EMAIL PROTECTED] wrote:
Why won't you use the struts-upload.war from the Struts distributions?

Regards,
David

-Original Message-
From: Jacob Ginu [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 23, 2003 9:48 PM
To: [EMAIL PROTECTED]
Subject: reg:File Upload

Hi,

Can anyone send me a sample file Upload program.

Regards,
Ginu

-
Do you Yahoo!?
Yahoo! Photos - Get your photo on the big screen in Times Square


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


-
Do you Yahoo!?
Yahoo! Photos - Get your photo on the big screen in Times Square

[ANNOUNCE] Carrier 2.0b3 with Unbreakable App Flows and File Upload/Download

2003-12-22 Thread Jing Zhou
Greetings!

Carrier 2.0b3 and its core source codes are available now.
Carrier is built on top of Struts and enables non-programming
designers to compose and exchange web form based messages.

With this release, the designers could compose web forms
with a fixed number or dynamic number of file attachments
by binding File Fields to custom File Properties
in the form bean model. The file download is achieved by
binding a Link Button/Click Button to the custom File Properties.
Thanks the Struts and the fileupload developers, now designers
could do it without single line of codes. There is a demo for
this capability in the distribution.

Another major feature introduced is the Unbreakable
App Flows - no matter which browser's button is clicked by
accident or on purpose, such as the Back/Forward/Refresh
buttons, an app flow is able to continue from where
it is interrupted without losing any state information. This
feature is active when the no client cache and the server
side cache are enabled. It is hidden completely from
the designer's point of view. If the request/response cycle
is a long run job, it get handled systematically - you can
wait until the response is returned or cancel the response.

A custom DateProperty is also introduced in this release.
The format pattern or its key in resource bundle and error
key are all encapsulated in one place. It offers a complete
i18n date property that encapsulate input/output format
or its key and error message or its key. It could also
be used in normalized mode as the standard java.sql.Date.

The phase for the Separation of Concerns has been finished.
We understand the hart of innovation involves
the phase for the Reduction of Concerns. This is where we
are now. Carrier offers non-programming designers the
ability to design live web applications with minimum
concerns, in many cases, no coding at all, and in the
meanwhile, resulting in the first class quality applications.
Try it and see how it works. The core algorithms are 
open to you. The WebLogic 8.1 and OC4J 9.03 are fully
supported in this release.

Happy Holidays!

Jing
Netspread Carrier Developer
http://www.netspread.com















Re: file upload

2003-11-16 Thread Caoilte O'Connor
i've not used dynaforms with fileupload so if that is the 
problem I couldn't say. you could try it with a normal 
formBean.

However as the problem is trying to set  a formfile using a 
string it looks like the problem could be in your jsp.

have you set the enctype like below,
html:form action=/blah enctype=multipart/form-data

and the form property using html:file rather than html:text
html:file property=pb_file/

goodluck,

c


On Friday 14 November 2003 13:38, sairam manda wrote:
 Hello Sir,

 I am new to sturts . I want to upload a file . I am using
 dynaform .

 these are snippets
 in the dynaform I used


  form-property name=pb_file
 type=org.apache.struts.upload.FormFile/


 and in my action class
 I used the following code


  FormFile file = (FormFile) form.get(pb_file);

 I get the following error


 org.apache.commons.beanutils.ConversionException: Cannot
 assign value of type 'java.lang.String' to property
 'pb_file' of type 'org.apache.struts.upload.FormFile'
   org.apache.struts.action.DynaActionForm.set(DynaActionFo
rm.java:423)
 org.apache.commons.beanutils.PropertyUtils.setSimplePrope
rty(PropertyUtils.java:1769)
 org.apache.commons.beanutils.PropertyUtils.setNestedPrope
rty(PropertyUtils.java:1684)
 org.apache.commons.beanutils.PropertyUtils.setProperty(Pr
opertyUtils.java:1713)
 org.apache.commons.beanutils.BeanUtils.setProperty(BeanUt
ils.java:1019)
 org.apache.commons.beanutils.BeanUtils.populate(BeanUtils
.java:808)
 org.apache.struts.util.RequestUtils.populate(RequestUtils
.java:1252)
 org.apache.struts.action.RequestProcessor.processPopulate
(RequestProcessor.java:821)
 org.apache.struts.action.RequestProcessor.process(Request
Processor.java:254)
 org.apache.struts.action.ActionServlet.process(ActionServ
let.java:1482)
 org.apache.struts.action.ActionServlet.doPost(ActionServl
et.java:525)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:7
63)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:8
56)


 can somebody make me waware of the problem.
 regards
 sairam

 _
 Enjoy shopping online? Get this e credit card.
 http://server1.msn.co.in/features/amex/ It cuts cost 
 adds value!


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


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



file upload

2003-11-14 Thread sairam manda
Hello Sir,

I am new to sturts . I want to upload a file . I am using dynaform .

these are snippets
in the dynaform I used
form-property name=pb_file 
type=org.apache.struts.upload.FormFile/

and in my action class
I used the following code
FormFile file = (FormFile) form.get(pb_file);

I get the following error

org.apache.commons.beanutils.ConversionException: Cannot assign value of 
type 'java.lang.String' to property 'pb_file' of type 
'org.apache.struts.upload.FormFile'
	org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:423)
	org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1769)
	org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)
	org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)
	org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
	org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
	org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)
	org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
	org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
	org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

can somebody make me waware of the problem.
regards
sairam
_
Enjoy shopping online? Get this e credit card. 
http://server1.msn.co.in/features/amex/ It cuts cost  adds value!

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


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

html:form action=/ImageUploadSubmit enctype=multipart/form-data

html:file property=fileName/

br
html:submit value=Upload/
/html:form



java.lang.NoSuchMethodError: org.apache.commons.fileupload.FileUpload.setSizeMax
(I)V
at org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest
(CommonsMultipartRequestHandler.java:219)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1055)
at org.apache.struts.action.RequestProcessor.processPopulate
(RequestProcessor.java:798)
at org.apache.struts.action.RequestProcessor.process
(RequestProcessor.java:254)
at org.apache.struts.action.ActionServlet.process
(ActionServlet.java:1422)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at 
com.tavant.lg.controller.servlet.LoanGeniusFrontControllerServlet.service
(LoanGeniusFrontControllerServlet.java:81)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:1053)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet
(ServletStubImpl.java:387)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet
(ServletStubImpl.java:305)
at 
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run
(WebAppServletContext.java:6291)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs
(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs
(SecurityManager.java:97)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet
(WebAppServletContext.java:3575)
at weblogic.servlet.internal.ServletRequestImpl.execute
(ServletRequestImpl.java:2573)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:178)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151)
 
==


Any Suggestion or help will be highly appreciated.


Best Regards
Raman Garg

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),

  controller
maxFileSize=300K /



c


On Wednesday 12 November 2003 08:18, Raman Garg wrote:
 Hi,

  We are getting error while file uploading using struts
 1.1. We have a demo code for file uploading which
 demostrates the file uploading using struts. When we run
 there application code works fine but  when we submit the
 form by setting enctype for the form it throws the
 following error. (Remember we are not doing anything in
 the action or in the form just getteer and setters) so
 issue is with enctype settings. It may use some internal
 class while sending data using enctype. Please advise us
 what to do.

 We downloaded the sample file uploading code from :
 http://forum.exadel.com/viewtopic.php?t=120

 But according to me the problem can be with setting of
 enctype.

 follwoing is the  code for our form

 html:form action=/ImageUploadSubmit
 enctype=multipart/form-data

 html:file property=fileName/

 br
 html:submit value=Upload/
 /html:form



 java.lang.NoSuchMethodError:
 org.apache.commons.fileupload.FileUpload.setSizeMax (I)V
 at
 org.apache.struts.upload.CommonsMultipartRequestHandler.h
andleRequest (CommonsMultipartRequestHandler.java:219)
 at
 org.apache.struts.util.RequestUtils.populate(RequestUtils
.java:1055) at
 org.apache.struts.action.RequestProcessor.processPopulate
 (RequestProcessor.java:798)
 at
 org.apache.struts.action.RequestProcessor.process
 (RequestProcessor.java:254)
 at org.apache.struts.action.ActionServlet.process
 (ActionServlet.java:1422)
 at
 org.apache.struts.action.ActionServlet.doPost(ActionServl
et.java:523) at
 javax.servlet.http.HttpServlet.service(HttpServlet.java:7
60) at
 com.tavant.lg.controller.servlet.LoanGeniusFrontControlle
rServlet.service
 (LoanGeniusFrontControllerServlet.java:81)
 at
 javax.servlet.http.HttpServlet.service(HttpServlet.java:8
53) at
 weblogic.servlet.internal.ServletStubImpl$ServletInvocati
onAction.run (ServletStubImpl.java:1053)
 at
 weblogic.servlet.internal.ServletStubImpl.invokeServlet
 (ServletStubImpl.java:387)
 at
 weblogic.servlet.internal.ServletStubImpl.invokeServlet
 (ServletStubImpl.java:305)
 at
 weblogic.servlet.internal.WebAppServletContext$ServletInv
ocationAction.run (WebAppServletContext.java:6291)
 at
 weblogic.security.acl.internal.AuthenticatedSubject.doAs
 (AuthenticatedSubject.java:317)
 at
 weblogic.security.service.SecurityManager.runAs
 (SecurityManager.java:97)
 at
 weblogic.servlet.internal.WebAppServletContext.invokeServ
let (WebAppServletContext.java:3575)
 at
 weblogic.servlet.internal.ServletRequestImpl.execute
 (ServletRequestImpl.java:2573)
 at
 weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:
178) at
 weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151)

 ==


 Any Suggestion or help will be highly appreciated.


 Best Regards
 Raman Garg


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



Re: File upload problem with Struts 1.1

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),

   controller
 maxFileSize=300K /



 c


 On Wednesday 12 November 2003 08:18, Raman Garg wrote:
  Hi,
 
   We are getting error while file uploading using struts
  1.1. We have a demo code for file uploading which
  demostrates the file uploading using struts. When we run
  there application code works fine but  when we submit the
  form by setting enctype for the form it throws the
  following error. (Remember we are not doing anything in
  the action or in the form just getteer and setters) so
  issue is with enctype settings. It may use some internal
  class while sending data using enctype. Please advise us
  what to do.
 
  We downloaded the sample file uploading code from :
  http://forum.exadel.com/viewtopic.php?t=120
 
  But according to me the problem can be with setting of
  enctype.
 
  follwoing is the  code for our form
 
  html:form action=/ImageUploadSubmit
  enctype=multipart/form-data
 
  html:file property=fileName/
 
  br
  html:submit value=Upload/
  /html:form
 
 
 
  java.lang.NoSuchMethodError:
  org.apache.commons.fileupload.FileUpload.setSizeMax (I)V
  at
  org.apache.struts.upload.CommonsMultipartRequestHandler.h
 andleRequest (CommonsMultipartRequestHandler.java:219)
  at
  org.apache.struts.util.RequestUtils.populate(RequestUtils
 .java:1055) at
  org.apache.struts.action.RequestProcessor.processPopulate
  (RequestProcessor.java:798)
  at
  org.apache.struts.action.RequestProcessor.process
  (RequestProcessor.java:254)
  at org.apache.struts.action.ActionServlet.process
  (ActionServlet.java:1422)
  at
  org.apache.struts.action.ActionServlet.doPost(ActionServl
 et.java:523) at
  javax.servlet.http.HttpServlet.service(HttpServlet.java:7
 60) at
  com.tavant.lg.controller.servlet.LoanGeniusFrontControlle
 rServlet.service
  (LoanGeniusFrontControllerServlet.java:81)
  at
  javax.servlet.http.HttpServlet.service(HttpServlet.java:8
 53) at
  weblogic.servlet.internal.ServletStubImpl$ServletInvocati
 onAction.run (ServletStubImpl.java:1053)
  at
  weblogic.servlet.internal.ServletStubImpl.invokeServlet
  (ServletStubImpl.java:387)
  at
  weblogic.servlet.internal.ServletStubImpl.invokeServlet
  (ServletStubImpl.java:305)
  at
  weblogic.servlet.internal.WebAppServletContext$ServletInv
 ocationAction.run (WebAppServletContext.java:6291)
  at
  weblogic.security.acl.internal.AuthenticatedSubject.doAs
  (AuthenticatedSubject.java:317)
  at
  weblogic.security.service.SecurityManager.runAs
  (SecurityManager.java:97)
  at
  weblogic.servlet.internal.WebAppServletContext.invokeServ
 let (WebAppServletContext.java:3575)
  at
  weblogic.servlet.internal.ServletRequestImpl.execute
  (ServletRequestImpl.java:2573)
  at
  weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:
 178) at
  weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151)
 
  ==
 
 
  Any Suggestion or help will be highly appreciated.
 
 
  Best Regards
  Raman Garg


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



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



Re: File upload problem with Struts 1.1

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),
 
controller
  maxFileSize=300K /
 
 
 
  c
 
  On Wednesday 12 November 2003 08:18, Raman Garg wrote:
   Hi,
  
We are getting error while file uploading using
   struts 1.1. We have a demo code for file uploading
   which demostrates the file uploading using struts.
   When we run there application code works fine but 
   when we submit the form by setting enctype for the
   form it throws the following error. (Remember we are
   not doing anything in the action or in the form just
   getteer and setters) so issue is with enctype
   settings. It may use some internal class while
   sending data using enctype. Please advise us what to
   do.
  
   We downloaded the sample file uploading code from :
   http://forum.exadel.com/viewtopic.php?t=120
  
   But according to me the problem can be with setting
   of enctype.
  
   follwoing is the  code for our form
  
   html:form action=/ImageUploadSubmit
   enctype=multipart/form-data
  
   html:file property=fileName/
  
   br
   html:submit value=Upload/
   /html:form
  
  
  
   java.lang.NoSuchMethodError:
   org.apache.commons.fileupload.FileUpload.setSizeMax
   (I)V at
   org.apache.struts.upload.CommonsMultipartRequestHandl
  er.h andleRequest
   (CommonsMultipartRequestHandler.java:219) at
   org.apache.struts.util.RequestUtils.populate(RequestU
  tils .java:1055) at
   org.apache.struts.action.RequestProcessor.processPopu
  late (RequestProcessor.java:798)
   at
   org.apache.struts.action.RequestProcessor.process
   (RequestProcessor.java:254)
   at
   org.apache.struts.action.ActionServlet.process
   (ActionServlet.java:1422)
   at
   org.apache.struts.action.ActionServlet.doPost(ActionS
  ervl et.java:523) at
   javax.servlet.http.HttpServlet.service(HttpServlet.ja
  va:7 60) at
   com.tavant.lg.controller.servlet.LoanGeniusFrontContr
  olle rServlet.service
   (LoanGeniusFrontControllerServlet.java:81)
   at
   javax.servlet.http.HttpServlet.service(HttpServlet.ja
  va:8 53) at
   weblogic.servlet.internal.ServletStubImpl$ServletInvo
  cati onAction.run (ServletStubImpl.java:1053)
   at
   weblogic.servlet.internal.ServletStubImpl.invokeServl
  et (ServletStubImpl.java:387)
   at
   weblogic.servlet.internal.ServletStubImpl.invokeServl
  et (ServletStubImpl.java:305)
   at
   weblogic.servlet.internal.WebAppServletContext$Servle
  tInv ocationAction.run
   (WebAppServletContext.java:6291) at
   weblogic.security.acl.internal.AuthenticatedSubject.d
  oAs (AuthenticatedSubject.java:317)
   at
   weblogic.security.service.SecurityManager.runAs
   (SecurityManager.java:97)
   at
   weblogic.servlet.internal.WebAppServletContext.invoke
  Serv let (WebAppServletContext.java:3575)
   at
   weblogic.servlet.internal.ServletRequestImpl.execute
   (ServletRequestImpl.java:2573)
   at
   weblogic.kernel.ExecuteThread.execute(ExecuteThread.j
  ava: 178) at
   weblogic.kernel.ExecuteThread.run(ExecuteThread.java:
  151)
  
   ==
  
  
   Any Suggestion or help will be highly appreciated.
  
  
   Best Regards
   Raman Garg
 
  ---
 -- To unsubscribe, e-mail:
  [EMAIL PROTECTED] For
  additional commands, e-mail:
  [EMAIL PROTECTED]

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


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



Re: File upload problem with Struts 1.1

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

html:form action=/ImageUploadSubmit enctype=multipart/form-data

html:file property=fileName/

br
html:submit value=Upload/
/html:form



java.lang.NoSuchMethodError:
org.apache.commons.fileupload.FileUpload.setSizeMax
(I)V
at
org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest
(CommonsMultipartRequestHandler.java:219)
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1055)
at org.apache.struts.action.RequestProcessor.processPopulate
(RequestProcessor.java:798)
at org.apache.struts.action.RequestProcessor.process
(RequestProcessor.java:254)
at org.apache.struts.action.ActionServlet.process
(ActionServlet.java:1422)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at
com.tavant.lg.controller.servlet.LoanGeniusFrontControllerServlet.service
(LoanGeniusFrontControllerServlet.java:81)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:1053)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet
(ServletStubImpl.java:387)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet
(ServletStubImpl.java:305)
at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run
(WebAppServletContext.java:6291)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs
(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs
(SecurityManager.java:97)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet
(WebAppServletContext.java:3575)
at weblogic.servlet.internal.ServletRequestImpl.execute
(ServletRequestImpl.java:2573)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:178)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151)

==


Any Suggestion or help will be highly appreciated.


Best Regards
Raman Garg




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



Re: Struts php file upload

2003-10-23 Thread Martin Cooper

Craig R. McClanahan [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Rajat Pandit wrote:

 Hello,
 I had this thought this morning, please excuse me if it seems rather
 silly. But I was wondering if there is a possibility for accessing the
 information put in the session or request scope by the servlet via php.
 I came up with this idea when I had to learn how the http upload thing
 works.
 
 
 Interesting timing that you should mention that.

 There is a relatively new JSR (JSR-223) that is focused on defining
 standard interfaces between the J2EE paltform and scripting languages,
 including (but not limited to) PHP.  Among other things, they are
 looking at making it possible to share session-scoped information
 between the two languages.  I can by no means guarantee that such
 functionality will be included in whatever JSR-223 results in, but at
 least it's being looked at.

 Second part: cant someone give me  a quick example (descriptive) of how
 to upload a file and move it to a particular place on the server.
 
 
 
 The simplest way to approach this is to consider it as two separate
 problems:

 * How do I get the file uploaded to the server?  The standard
 commons-fileupload
   funcationality takes care of that, and should be sufficient as long as
 the uploaded
   file fits in memory.  If it doesn't, you'll want to look at the
 Javadocs for commons-fileupload
   to determine how to write the uploaded data to a disk file on the
 server instead.

Actually, the the file will only be kept in memory if its size falls below a
configurable threshold. If it's larger than that, it will be written to a
temporary file on disk. The threshold is configured using the 'memFileSize'
attribute on the 'controller' element in your Struts config file; the
default is 256KB.

--
Martin Cooper



 * How do I move the data to a particular place on the server?  If
 you've got the uploaded
   data in memory, this seems like a pretty simple task ... open an
 output file and write the
   uploaded bytes to it.  If you stored the uploaded data into a disk
 file instead, then it's
   probably either using the rename() method of the java.io.File class,
 or a 20-line method to
   copy the data from one file to another -- and any basic Java tutorial
 on file I/O should be
   able to help you there.

 Craig




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



Struts php file upload

2003-10-22 Thread Rajat Pandit
Hello,
I had this thought this morning, please excuse me if it seems rather
silly. But I was wondering if there is a possibility for accessing the
information put in the session or request scope by the servlet via php.
I came up with this idea when I had to learn how the http upload thing
works.

Second part: cant someone give me  a quick example (descriptive) of how
to upload a file and move it to a particular place on the server.

Thanks in advance




Rajat Pandit | [EMAIL PROTECTED]
+91 612 3117606
[ Developer and Part Time Human Being]


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



RE: Struts php file upload

2003-10-22 Thread Daniel Washusen
 -Original Message-
 From: Rajat Pandit [mailto:[EMAIL PROTECTED]
 Sent: Thursday, 23 October 2003 1:55 PM
 To: [EMAIL PROTECTED]
 Subject: Struts  php  file upload


 Hello,
 I had this thought this morning, please excuse me if it seems rather
 silly. But I was wondering if there is a possibility for accessing the
 information put in the session or request scope by the servlet via php.
 I came up with this idea when I had to learn how the http upload thing
 works.

not without a lot of stuffing around I would think...


 Second part: cant someone give me  a quick example (descriptive) of how
 to upload a file and move it to a particular place on the server.


have a look at the struts-upload.war example that comes with the struts
package.

 Thanks in advance




 Rajat Pandit | [EMAIL PROTECTED]
 +91 612 3117606
 [ Developer and Part Time Human Being]


 -
 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: Struts php file upload

2003-10-22 Thread Craig R. McClanahan
Rajat Pandit wrote:

Hello,
I had this thought this morning, please excuse me if it seems rather
silly. But I was wondering if there is a possibility for accessing the
information put in the session or request scope by the servlet via php.
I came up with this idea when I had to learn how the http upload thing
works.
 

Interesting timing that you should mention that.

There is a relatively new JSR (JSR-223) that is focused on defining 
standard interfaces between the J2EE paltform and scripting languages, 
including (but not limited to) PHP.  Among other things, they are 
looking at making it possible to share session-scoped information 
between the two languages.  I can by no means guarantee that such 
functionality will be included in whatever JSR-223 results in, but at 
least it's being looked at.

Second part: cant someone give me  a quick example (descriptive) of how
to upload a file and move it to a particular place on the server.
 

The simplest way to approach this is to consider it as two separate 
problems:

* How do I get the file uploaded to the server?  The standard 
commons-fileupload
 funcationality takes care of that, and should be sufficient as long as 
the uploaded
 file fits in memory.  If it doesn't, you'll want to look at the 
Javadocs for commons-fileupload
 to determine how to write the uploaded data to a disk file on the 
server instead.

* How do I move the data to a particular place on the server?  If 
you've got the uploaded
 data in memory, this seems like a pretty simple task ... open an 
output file and write the
 uploaded bytes to it.  If you stored the uploaded data into a disk 
file instead, then it's
 probably either using the rename() method of the java.io.File class, 
or a 20-line method to
 copy the data from one file to another -- and any basic Java tutorial 
on file I/O should be
 able to help you there.

Craig



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


Re: file upload and IllegalArgumentException:

2003-10-02 Thread Franck Lefebure
Hi,
the enc-type is described in the jsp.
in Struts-config I just have :

  form-beans
form-bean name=serverForm
type=com.orange.struts.beans.servers.ServerForm/
  /form-beans

action name=serverForm path=/doServer input=/doServer.do
scope=request type=com.orange.struts.actions.servers.ServerAction
parameter=action
  forward name=success path=/index.jsp redirect=false/
/action

But since yesterday I've tested the other actions where I use formfile In my
Struts applications
I ve this exception everywhere

I think I've upgraded a jar somewhere causing this error (I'm actually
looking the commons lib versions)

Regards

--

Franck Lefebure
equipe web http://www.orangecaraibe.com
mailto:[EMAIL PROTECTED]
- Original Message -
From: k_emilov [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, October 02, 2003 3:59 AM
Subject: multipart-form/data enc type


 Hi ,

 I think , the problem is that you describe enc type in struts-
 config.xml ... If you describe it in the .jsp
 html:form action=/doServer  enctype=multipart/form-data  , it
 will not attempt to set FormFile property with an empty string ,
 causing illegal argument exception

 There is another workaround, certainly - not to define form property
 of type FormFile in xml, but to take it from requesyt object.

 Please , reply what happened

 Regards

 Konstantin



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



Re: file upload and IllegalArgumentException: FOUND !

2003-10-02 Thread Franck Lefebure
Well,
I've found the problem,

It wasn't my code ..
It wasn't commons libraries ...

I recently upgraded my Opera Browser version  : 7.20.3087.

This version of Opera doesn't seem to support use of Formfile
(if you leave a file input blank)

can anyone confirm that ?

I would like to do a bug report but I've never done something like that
and I don't know if it's a Struts or an Opera bug .

any council ?

Franck Lefebure
equipe web http://www.orangecaraibe.com
mailto:[EMAIL PROTECTED]
- Original Message -
From: Franck Lefebure [EMAIL PROTECTED]
To: k_emilov [EMAIL PROTECTED]; 'Struts Users Mailing List'
[EMAIL PROTECTED]
Sent: Thursday, October 02, 2003 9:15 AM
Subject: Re: file upload and IllegalArgumentException:


 Hi,
 the enc-type is described in the jsp.
 in Struts-config I just have :

   form-beans
 form-bean name=serverForm
 type=com.orange.struts.beans.servers.ServerForm/
   /form-beans

 action name=serverForm path=/doServer input=/doServer.do
 scope=request type=com.orange.struts.actions.servers.ServerAction
 parameter=action
   forward name=success path=/index.jsp redirect=false/
 /action

 But since yesterday I've tested the other actions where I use formfile In
my
 Struts applications
 I ve this exception everywhere

 I think I've upgraded a jar somewhere causing this error (I'm actually
 looking the commons lib versions)

 Regards

 --

 Franck Lefebure
 equipe web http://www.orangecaraibe.com
 mailto:[EMAIL PROTECTED]
 - Original Message -
 From: k_emilov [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, October 02, 2003 3:59 AM
 Subject: multipart-form/data enc type


  Hi ,
 
  I think , the problem is that you describe enc type in struts-
  config.xml ... If you describe it in the .jsp
  html:form action=/doServer  enctype=multipart/form-data  , it
  will not attempt to set FormFile property with an empty string ,
  causing illegal argument exception
 
  There is another workaround, certainly - not to define form property
  of type FormFile in xml, but to take it from requesyt object.
 
  Please , reply what happened
 
  Regards
 
  Konstantin
 


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



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



file upload and IllegalArgumentException:

2003-10-01 Thread Franck Lefebure
Hi,
I have an action form html:form action=/doServer focus=name
method=post enctype=multipart/form-data 
with an html:file property='file'

the file of this form is optional.
but if the user doesn't choose file before submit  then there is an
IllegalArgumentException (stacktrace below):

I put some tracelogs in beanutils.PropertyUtils, I see that when struts is
populating the ActionForm from the Html form,
he tries to set a FormFile property with a (blank) String value, causing the
exception

Is there a workaround ?

Thanks

--
Franck Lefebure



PRE B/servers/doServer.do:/B BeanUtils.populate
java.lang.IllegalArgumentException: argument type mismatch at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.j
ava:1790) at
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.j
ava:1685) at
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:17
14) at
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019) at
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808) at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252) at






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



RE: Slow file upload?

2003-09-16 Thread Mohd Amin Mohd Din
Hmm, just checking, are you doing any processing other than just simply
storing the file.

-Original Message-
From: Bjørn T Johansen [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 16, 2003 12:51 PM
To: Struts Users Mailing List
Subject: Re: Slow file upload?

On Tue, 2003-09-16 at 06:19, Robert Leland wrote:

 Bjørn T Johansen wrote:
 
 On Tue, 2003-09-16 at 04:12, Robert Leland wrote:
 
   
 
 Bjørn T Johansen wrote:
 
 
 
 I am testing file upload using Struts and FormFile but the upload
seems
 really slow. Uploading a 1,5MB file takes about 15-20 sec. and I am
 running both the server and the browser on the same PC. Is this
normal
 or should the upload be faster?
  
 
   
 
 Your upload will be slower all on one machine as opposed to going
across 
 a fast LAN.
 However, that does seem slow. I have uploaded a 650MB file in about
7 
 minutes across a LAN.
 650MB/7 minutes  =~ 1.5 MB/sec.
 Are you using Strust 1.1 and the default fileupload implementation
which 
 is commons-fileupload ?
 What browser, How much free RAM, CPU etc..
 
 
 
 
 Yes, I am using Struts 1.1 and the default upload in
commons-fileupload.
 The hw I am running on is a 2.4GHz PC with 1GB memory, with at least
 half of it free.. The browser I tried the upload with was Mozilla..
   
 
 
 What does your CPU utilization look like ?
 What does your (physical/virtual)  memory utilization look like, what
% 
 is available ?
 Is it high, low, which process is taking the most CPU/memory ?
 How many process are running in your JVM(s) and what are the JVM
virtual 
 memory settings at startup.
 Usually there is a  setting something like  -Xm256 for java.exe are
you 
 setting this ?
 Look at the docs for java.exe for the exact options, then try
increasing 
 say by 50% and see if
 it helps, or crashes your machine because windows doesn't have enough 
 Virtual memory to give to the
 JVM. Then you increase Windows virtual memory if needed.
 
 Also note that if Mozilla is like Netscape then it makes a copy of the

 file before beginning sending it.
 The temp file is either under C:\temp or C:\Documents and 
 Settings\User\Local Settings\Temp.
 If it make the copy fairly quickly, less than 1 second, then look at
your

Well, I am running this on Linux and the load is almost 0, so it's not a
question of the load on my computer..
But I'll try increasing the memory given to the Java VM when I get home
tonight and also try another browser


BTJ



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



RE: Slow file upload?

2003-09-16 Thread Bjørn T Johansen
Nope

On Tue, 2003-09-16 at 08:48, Mohd Amin Mohd Din wrote:

 Hmm, just checking, are you doing any processing other than just simply
 storing the file.
 
 -Original Message-
 From: Bjørn T Johansen [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, September 16, 2003 12:51 PM
 To: Struts Users Mailing List
 Subject: Re: Slow file upload?
 
 On Tue, 2003-09-16 at 06:19, Robert Leland wrote:
 
  Bjørn T Johansen wrote:
  
  On Tue, 2003-09-16 at 04:12, Robert Leland wrote:
  

  
  Bjørn T Johansen wrote:
  
  
  
  I am testing file upload using Struts and FormFile but the upload
 seems
  really slow. Uploading a 1,5MB file takes about 15-20 sec. and I am
  running both the server and the browser on the same PC. Is this
 normal
  or should the upload be faster?
   
  

  
  Your upload will be slower all on one machine as opposed to going
 across 
  a fast LAN.
  However, that does seem slow. I have uploaded a 650MB file in about
 7 
  minutes across a LAN.
  650MB/7 minutes  =~ 1.5 MB/sec.
  Are you using Strust 1.1 and the default fileupload implementation
 which 
  is commons-fileupload ?
  What browser, How much free RAM, CPU etc..
  
  
  
  
  Yes, I am using Struts 1.1 and the default upload in
 commons-fileupload.
  The hw I am running on is a 2.4GHz PC with 1GB memory, with at least
  half of it free.. The browser I tried the upload with was Mozilla..

  
  
  What does your CPU utilization look like ?
  What does your (physical/virtual)  memory utilization look like, what
 % 
  is available ?
  Is it high, low, which process is taking the most CPU/memory ?
  How many process are running in your JVM(s) and what are the JVM
 virtual 
  memory settings at startup.
  Usually there is a  setting something like  -Xm256 for java.exe are
 you 
  setting this ?
  Look at the docs for java.exe for the exact options, then try
 increasing 
  say by 50% and see if
  it helps, or crashes your machine because windows doesn't have enough 
  Virtual memory to give to the
  JVM. Then you increase Windows virtual memory if needed.
  
  Also note that if Mozilla is like Netscape then it makes a copy of the
 
  file before beginning sending it.
  The temp file is either under C:\temp or C:\Documents and 
  Settings\User\Local Settings\Temp.
  If it make the copy fairly quickly, less than 1 second, then look at
 your
 
 Well, I am running this on Linux and the load is almost 0, so it's not a
 question of the load on my computer..
 But I'll try increasing the memory given to the Java VM when I get home
 tonight and also try another browser
 
 
 BTJ
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


Re: Slow file upload?

2003-09-16 Thread Sgarlata Matt
Unfortunately I'm not going to have time to set up this experiment for a few
weeks because the app I am currently working on does not require file upload
capabilities.  I'll do a test in a few weeks and post the results to
struts-user.

I'm guessing from your response that the costs of encoding/decoding the file
so it can be sent over HTTP/MIME is much larger than one would suppose and
that this time is greater than the time it takes to send the file over a
large connection.

Thanks,

Matt
- Original Message - 
From: Robert Leland [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Monday, September 15, 2003 10:40 PM
Subject: Re: Slow file upload?


Sgarlata Matt wrote:

Rob, why is it faster to upload all on one machine instead of going across
a
LAN?  It seems to me uploading on the same machine should be as fast as a
file copy.  What am I missing?


Try a experiment. Try a fileupload on a single CPU computer, hosting
your web app.
Then try it again for 2 machines connected by the same local LAN, one
running the browser, one the web app.
Monitor fileupload time, % free CPU, virtual memory/paging usage, etc.
Report back the results.



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



Re: Slow file upload?

2003-09-16 Thread as as
i am a newbie to struts
need help intsalling and making a helloworld app run using Tomcat jakarta struts
also need help learning to use filters to authenticate a user,
Samy


Sgarlata Matt [EMAIL PROTECTED] wrote:Unfortunately I'm not going to have time to 
set up this experiment for a few
weeks because the app I am currently working on does not require file upload
capabilities. I'll do a test in a few weeks and post the results to
struts-user.

I'm guessing from your response that the costs of encoding/decoding the file
so it can be sent over HTTP/MIME is much larger than one would suppose and
that this time is greater than the time it takes to send the file over a
large connection.

Thanks,

Matt
- Original Message - 
From: Robert Leland 
To: Struts Users Mailing List 
Sent: Monday, September 15, 2003 10:40 PM
Subject: Re: Slow file upload?


Sgarlata Matt wrote:

Rob, why is it faster to upload all on one machine instead of going across
a
LAN? It seems to me uploading on the same machine should be as fast as a
file copy. What am I missing?


Try a experiment. Try a fileupload on a single CPU computer, hosting
your web app.
Then try it again for 2 machines connected by the same local LAN, one
running the browser, one the web app.
Monitor fileupload time, % free CPU, virtual memory/paging usage, etc.
Report back the results.



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



-
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software

RE: Slow file upload?

2003-09-16 Thread Andrew Hill
http://www.catb.org/~esr/faqs/smart-questions.html

You could start by learning some ettiquet.. umm.. etikit, uh.. etiq..
...some manners and not go around hijacking other peoples topic with an
unrelated question.

As for making helloworld have you tried to rt*m or st*w yet?
What have you done so far? What went wrong? We could help you better if you
ask some more specific questions.

-Original Message-
From: as as [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 16 September 2003 21:27
To: Struts Users Mailing List
Subject: Re: Slow file upload?


i am a newbie to struts
need help intsalling and making a helloworld app run using Tomcat jakarta
struts
also need help learning to use filters to authenticate a user,
Samy


Sgarlata Matt [EMAIL PROTECTED] wrote:Unfortunately I'm not going to
have time to set up this experiment for a few
weeks because the app I am currently working on does not require file upload
capabilities. I'll do a test in a few weeks and post the results to
struts-user.

I'm guessing from your response that the costs of encoding/decoding the file
so it can be sent over HTTP/MIME is much larger than one would suppose and
that this time is greater than the time it takes to send the file over a
large connection.

Thanks,

Matt
- Original Message -
From: Robert Leland
To: Struts Users Mailing List
Sent: Monday, September 15, 2003 10:40 PM
Subject: Re: Slow file upload?


Sgarlata Matt wrote:

Rob, why is it faster to upload all on one machine instead of going across
a
LAN? It seems to me uploading on the same machine should be as fast as a
file copy. What am I missing?


Try a experiment. Try a fileupload on a single CPU computer, hosting
your web app.
Then try it again for 2 machines connected by the same local LAN, one
running the browser, one the web app.
Monitor fileupload time, % free CPU, virtual memory/paging usage, etc.
Report back the results.



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



-
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: Slow file upload?

2003-09-16 Thread Kurt Post
If you are running on a Windows box, I would try using IE instead of Mozilla
for your timing tests.  On windows, Netscape and thus probably Mozilla,
seems to spin in a hard loop poling for new data while its trying to receive
data over the network.  This results in 100% CPU utilization and really
slows things down.  It might just be that it also spins in a hard loop when
its waiting for the transmit buffer to empty enough so it can continue to
send more data.

-Original Message-
From: Daniel Washusen [mailto:[EMAIL PROTECTED]
Sent: Monday, September 15, 2003 11:54 PM
To: Struts Users Mailing List
Subject: RE: Slow file upload?


 Yes, I am using Struts 1.1 and the default upload in commons-fileupload.
 The hw I am running on is a 2.4GHz PC with 1GB memory, with at least
 half of it free.. The browser I tried the upload with was Mozilla..

 BTJ


I'm running a P4 1.7 with 512MB of RAM and I can upload a 1.8 MB file in
about 1 second and a 8 MB file in about 3 seconds... Struts 1.1,
commons-fileupload and Tomcat 4.1.27.  Not really much help for you but it
would confirm that it all works...


-
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: Slow file upload?

2003-09-16 Thread Bjørn T Johansen
I just tried this from another PC running Windows and IE, and then the
upload took less than a second..
Is this a bug in Mozilla or?


BTJ

On Tue, 2003-09-16 at 15:58, Kurt Post wrote:

 If you are running on a Windows box, I would try using IE instead of Mozilla
 for your timing tests.  On windows, Netscape and thus probably Mozilla,
 seems to spin in a hard loop poling for new data while its trying to receive
 data over the network.  This results in 100% CPU utilization and really
 slows things down.  It might just be that it also spins in a hard loop when
 its waiting for the transmit buffer to empty enough so it can continue to
 send more data.
 
 -Original Message-
 From: Daniel Washusen [mailto:[EMAIL PROTECTED]
 Sent: Monday, September 15, 2003 11:54 PM
 To: Struts Users Mailing List
 Subject: RE: Slow file upload?
 
 
  Yes, I am using Struts 1.1 and the default upload in commons-fileupload.
  The hw I am running on is a 2.4GHz PC with 1GB memory, with at least
  half of it free.. The browser I tried the upload with was Mozilla..
 
  BTJ
 
 
 I'm running a P4 1.7 with 512MB of RAM and I can upload a 1.8 MB file in
 about 1 second and a 8 MB file in about 3 seconds... Struts 1.1,
 commons-fileupload and Tomcat 4.1.27.  Not really much help for you but it
 would confirm that it all works...
 
 
 -
 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: Slow file upload?

2003-09-16 Thread Kurt Post
Don't know if its really bug because it does actually work just fine; it
just chews up allot of CPU when doing network I/O.  I'm not sure if this
only happens on Windows boxes or if it happens on other platforms as well.

The thing about Netscape/Mozilla is that it runs on allot of different
platforms.  And many of the different platforms have a slightly different
take on how you do asynchronous non-blocking network I/O.  So they probably
have created some library to abstract out these differences.  Now maybe its
a bug in how they implemented asynchronous non blocking I/O on windows or
maybe they just decided it would be easier to poll rather then handling the
many different ways different Os's can provide asynchronous notification
that there is more data available or that its OK to send more data.

-Original Message-
From: Bjørn T Johansen [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 16, 2003 11:04 AM
To: Struts Users Mailing List
Subject: RE: Slow file upload?


I just tried this from another PC running Windows and IE, and then the
upload took less than a second..
Is this a bug in Mozilla or?


BTJ

On Tue, 2003-09-16 at 15:58, Kurt Post wrote:

 If you are running on a Windows box, I would try using IE instead of
Mozilla
 for your timing tests.  On windows, Netscape and thus probably Mozilla,
 seems to spin in a hard loop poling for new data while its trying to
receive
 data over the network.  This results in 100% CPU utilization and really
 slows things down.  It might just be that it also spins in a hard loop
when
 its waiting for the transmit buffer to empty enough so it can continue to
 send more data.

 -Original Message-
 From: Daniel Washusen [mailto:[EMAIL PROTECTED]
 Sent: Monday, September 15, 2003 11:54 PM
 To: Struts Users Mailing List
 Subject: RE: Slow file upload?


  Yes, I am using Struts 1.1 and the default upload in commons-fileupload.
  The hw I am running on is a 2.4GHz PC with 1GB memory, with at least
  half of it free.. The browser I tried the upload with was Mozilla..
 
  BTJ
 

 I'm running a P4 1.7 with 512MB of RAM and I can upload a 1.8 MB file in
 about 1 second and a 8 MB file in about 3 seconds... Struts 1.1,
 commons-fileupload and Tomcat 4.1.27.  Not really much help for you but it
 would confirm that it all works...


 -
 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: Slow file upload?

2003-09-16 Thread Robert Leland
Sgarlata Matt wrote:

Unfortunately I'm not going to have time to set up this experiment for a few
weeks because the app I am currently working on does not require file upload
capabilities.  I'll do a test in a few weeks and post the results to
struts-user.
I'm guessing from your response that the costs of encoding/decoding the file
so it can be sent over HTTP/MIME is much larger than one would suppose and
that this time is greater than the time it takes to send the file over a
large connection.
 

The experiment was to get you to think about what might be going on in 
your system.
Compared to FTP the fileupload is about 70-80% as fast. Surprisingly the 
encoding/decoding
is pretty quick.



Thanks,

Matt



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


Slow file upload?

2003-09-15 Thread Bjørn T Johansen
I am testing file upload using Struts and FormFile but the upload seems
really slow. Uploading a 1,5MB file takes about 15-20 sec. and I am
running both the server and the browser on the same PC. Is this normal
or should the upload be faster?


BTJ


Re: Slow file upload?

2003-09-15 Thread Robert Leland
Bjørn T Johansen wrote:

I am testing file upload using Struts and FormFile but the upload seems
really slow. Uploading a 1,5MB file takes about 15-20 sec. and I am
running both the server and the browser on the same PC. Is this normal
or should the upload be faster?
 

Your upload will be slower all on one machine as opposed to going across 
a fast LAN.
However, that does seem slow. I have uploaded a 650MB file in about 7 
minutes across a LAN.
650MB/7 minutes  =~ 1.5 MB/sec.
Are you using Strust 1.1 and the default fileupload implementation which 
is commons-fileupload ?
What browser, How much free RAM, CPU etc..

BTJ
 

-Rob

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


Re: Slow file upload?

2003-09-15 Thread Sgarlata Matt
Rob, why is it faster to upload all on one machine instead of going across a
LAN?  It seems to me uploading on the same machine should be as fast as a
file copy.  What am I missing?

Thanks,

Matt
- Original Message - 
From: Robert Leland [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Monday, September 15, 2003 10:12 PM
Subject: Re: Slow file upload?


Bjørn T Johansen wrote:

I am testing file upload using Struts and FormFile but the upload seems
really slow. Uploading a 1,5MB file takes about 15-20 sec. and I am
running both the server and the browser on the same PC. Is this normal
or should the upload be faster?


Your upload will be slower all on one machine as opposed to going across
a fast LAN.
However, that does seem slow. I have uploaded a 650MB file in about 7
minutes across a LAN.
650MB/7 minutes  =~ 1.5 MB/sec.
Are you using Strust 1.1 and the default fileupload implementation which
is commons-fileupload ?
What browser, How much free RAM, CPU etc..

BTJ



-Rob


-
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: Slow file upload?

2003-09-15 Thread Robert Leland
Sgarlata Matt wrote:

Rob, why is it faster to upload all on one machine instead of going across a
LAN?  It seems to me uploading on the same machine should be as fast as a
file copy.  What am I missing?
 

Try a experiment. Try a fileupload on a single CPU computer, hosting 
your web app.
Then try it again for 2 machines connected by the same local LAN, one 
running the browser, one the web app.
Monitor fileupload time, % free CPU, virtual memory/paging usage, etc.
Report back the results.

-Rob

Thanks,

Matt
- Original Message - 
From: Robert Leland [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Monday, September 15, 2003 10:12 PM
Subject: Re: Slow file upload?

Bjørn T Johansen wrote:

 

I am testing file upload using Struts and FormFile but the upload seems
really slow. Uploading a 1,5MB file takes about 15-20 sec. and I am
running both the server and the browser on the same PC. Is this normal
or should the upload be faster?
   

Your upload will be slower all on one machine as opposed to going across
a fast LAN.
However, that does seem slow. I have uploaded a 650MB file in about 7
minutes across a LAN.
650MB/7 minutes  =~ 1.5 MB/sec.
Are you using Strust 1.1 and the default fileupload implementation which
is commons-fileupload ?
What browser, How much free RAM, CPU etc..
 

BTJ

   

-Rob

-
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: Slow file upload?

2003-09-15 Thread Bjørn T Johansen
On Tue, 2003-09-16 at 04:12, Robert Leland wrote:

 Bjørn T Johansen wrote:
 
 I am testing file upload using Struts and FormFile but the upload seems
 really slow. Uploading a 1,5MB file takes about 15-20 sec. and I am
 running both the server and the browser on the same PC. Is this normal
 or should the upload be faster?
   
 
 Your upload will be slower all on one machine as opposed to going across 
 a fast LAN.
 However, that does seem slow. I have uploaded a 650MB file in about 7 
 minutes across a LAN.
 650MB/7 minutes  =~ 1.5 MB/sec.
 Are you using Strust 1.1 and the default fileupload implementation which 
 is commons-fileupload ?
 What browser, How much free RAM, CPU etc..
 

Yes, I am using Struts 1.1 and the default upload in commons-fileupload.
The hw I am running on is a 2.4GHz PC with 1GB memory, with at least
half of it free.. The browser I tried the upload with was Mozilla..

BTJ


RE: Slow file upload?

2003-09-15 Thread Daniel Washusen
 Yes, I am using Struts 1.1 and the default upload in commons-fileupload.
 The hw I am running on is a 2.4GHz PC with 1GB memory, with at least
 half of it free.. The browser I tried the upload with was Mozilla..

 BTJ


I'm running a P4 1.7 with 512MB of RAM and I can upload a 1.8 MB file in
about 1 second and a 8 MB file in about 3 seconds... Struts 1.1,
commons-fileupload and Tomcat 4.1.27.  Not really much help for you but it
would confirm that it all works...


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



Re: Slow file upload?

2003-09-15 Thread Robert Leland
Bjørn T Johansen wrote:

On Tue, 2003-09-16 at 04:12, Robert Leland wrote:

 

Bjørn T Johansen wrote:

   

I am testing file upload using Struts and FormFile but the upload seems
really slow. Uploading a 1,5MB file takes about 15-20 sec. and I am
running both the server and the browser on the same PC. Is this normal
or should the upload be faster?
 

Your upload will be slower all on one machine as opposed to going across 
a fast LAN.
However, that does seem slow. I have uploaded a 650MB file in about 7 
minutes across a LAN.
650MB/7 minutes  =~ 1.5 MB/sec.
Are you using Strust 1.1 and the default fileupload implementation which 
is commons-fileupload ?
What browser, How much free RAM, CPU etc..

   

Yes, I am using Struts 1.1 and the default upload in commons-fileupload.
The hw I am running on is a 2.4GHz PC with 1GB memory, with at least
half of it free.. The browser I tried the upload with was Mozilla..
 

What does your CPU utilization look like ?
What does your (physical/virtual)  memory utilization look like, what % 
is available ?
Is it high, low, which process is taking the most CPU/memory ?
How many process are running in your JVM(s) and what are the JVM virtual 
memory settings at startup.
Usually there is a  setting something like  -Xm256 for java.exe are you 
setting this ?
Look at the docs for java.exe for the exact options, then try increasing 
say by 50% and see if
it helps, or crashes your machine because windows doesn't have enough 
Virtual memory to give to the
JVM. Then you increase Windows virtual memory if needed.

Also note that if Mozilla is like Netscape then it makes a copy of the 
file before beginning sending it.
The temp file is either under C:\temp or C:\Documents and 
Settings\User\Local Settings\Temp.
If it make the copy fairly quickly, less than 1 second, then look at your

BTJ

 

-Rob


RE: Slow file upload?

2003-09-15 Thread Bjørn T Johansen
On Tue, 2003-09-16 at 05:53, Daniel Washusen wrote:

  Yes, I am using Struts 1.1 and the default upload in commons-fileupload.
  The hw I am running on is a 2.4GHz PC with 1GB memory, with at least
  half of it free.. The browser I tried the upload with was Mozilla..
 
  BTJ
 
 
 I'm running a P4 1.7 with 512MB of RAM and I can upload a 1.8 MB file in
 about 1 second and a 8 MB file in about 3 seconds... Struts 1.1,
 commons-fileupload and Tomcat 4.1.27.  Not really much help for you but it
 would confirm that it all works...
 
 
 -

Hmmm, strange... I am running almost the same, except for better hw.


BTJ


Re: Slow file upload?

2003-09-15 Thread Bjørn T Johansen
On Tue, 2003-09-16 at 06:19, Robert Leland wrote:

 Bjørn T Johansen wrote:
 
 On Tue, 2003-09-16 at 04:12, Robert Leland wrote:
 
   
 
 Bjørn T Johansen wrote:
 
 
 
 I am testing file upload using Struts and FormFile but the upload seems
 really slow. Uploading a 1,5MB file takes about 15-20 sec. and I am
 running both the server and the browser on the same PC. Is this normal
 or should the upload be faster?
  
 
   
 
 Your upload will be slower all on one machine as opposed to going across 
 a fast LAN.
 However, that does seem slow. I have uploaded a 650MB file in about 7 
 minutes across a LAN.
 650MB/7 minutes  =~ 1.5 MB/sec.
 Are you using Strust 1.1 and the default fileupload implementation which 
 is commons-fileupload ?
 What browser, How much free RAM, CPU etc..
 
 
 
 
 Yes, I am using Struts 1.1 and the default upload in commons-fileupload.
 The hw I am running on is a 2.4GHz PC with 1GB memory, with at least
 half of it free.. The browser I tried the upload with was Mozilla..
   
 
 
 What does your CPU utilization look like ?
 What does your (physical/virtual)  memory utilization look like, what % 
 is available ?
 Is it high, low, which process is taking the most CPU/memory ?
 How many process are running in your JVM(s) and what are the JVM virtual 
 memory settings at startup.
 Usually there is a  setting something like  -Xm256 for java.exe are you 
 setting this ?
 Look at the docs for java.exe for the exact options, then try increasing 
 say by 50% and see if
 it helps, or crashes your machine because windows doesn't have enough 
 Virtual memory to give to the
 JVM. Then you increase Windows virtual memory if needed.
 
 Also note that if Mozilla is like Netscape then it makes a copy of the 
 file before beginning sending it.
 The temp file is either under C:\temp or C:\Documents and 
 Settings\User\Local Settings\Temp.
 If it make the copy fairly quickly, less than 1 second, then look at your

Well, I am running this on Linux and the load is almost 0, so it's not a
question of the load on my computer..
But I'll try increasing the memory given to the Java VM when I get home
tonight and also try another browser


BTJ


Custom Validator and File Upload

2003-09-03 Thread Octavia Yung
Hi Everyone,

I am currently trying to create a custom validator for a file upload form and am 
unclear as to how to retrieve the value of the File field.  I would like to have the 
object as a FormFile so that I can perform further checks on the file.  Are there any 
examples available to peruse?  Your help is greatly appreciated.

Octavia

Help needed in using the file upload to databse tag

2003-09-02 Thread SriDevi C
Hi All,

I am new to using Struts.

I want to use struts in uploading a file to database.Kindly guide me in this
regard.
Kindly let me know which tld file to copy and where to copy and what is the
tag to use etc

It would be very kind of you if anyone can give me a sample code. I am
developing the application using JSP's using JDeveloper.

It's very urgent.

Thanks in advance,
Sridevi


 

This e-mail and any files transmitted with it are for the sole use of the
intended recipient(s) and may contain confidential and privileged
information. If you are not the intended recipient, please contact the
sender by reply e-mail and destroy all copies of the original message. Any
unauthorised review, use, disclosure, dissemination, forwarding, printing or
copying of this email or any action taken in reliance on this e-mail is
strictly prohibited and may be unlawful.
Visit us @ http://www.masconit.com





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



RE: Help needed in using the file upload to databse tag

2003-09-02 Thread Andrew Hill
Thats strange. It doesnt seem very urgent to me mate.
http://www.catb.org/~esr/faqs/smart-questions.html
I was thinking of letting my reply sit in the 'drafts' folder for a while
before sending it, but what with the wierd list behaviour at the moment I
figure it will be ages till the reply arrives anyway.

So have you examined the struts upload example yet?
(It comes with struts - and the .java files for the ActionForm and Action
are in its war too)
That should get you started on what you need to do to get the file from the
users side over to the server.

Having uploaded the file you would invoke the transfering of it to the
database from your Action. (Generally there would be some kind of
business-logic layer between the db and the actions, though for a simple
app, doing the db access work in the action will work well enough to start
with)
See: http://jakarta.apache.org/struts/faqs/database.html for info on playing
with databases in struts (though I dont think this link covers transferring
blobs?).

(btw: dont use the struts connection pooling impl as its deprecated - use
the one provided by your container)

-Original Message-
From: SriDevi C [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 3 September 2003 13:29
To: [EMAIL PROTECTED]
Subject: Help needed in using the file upload to databse tag
Importance: High


Hi All,

I am new to using Struts.

I want to use struts in uploading a file to database.Kindly guide me in this
regard.
Kindly let me know which tld file to copy and where to copy and what is the
tag to use etc

It would be very kind of you if anyone can give me a sample code. I am
developing the application using JSP's using JDeveloper.

It's very urgent.

Thanks in advance,
Sridevi




This e-mail and any files transmitted with it are for the sole use of the
intended recipient(s) and may contain confidential and privileged
information. If you are not the intended recipient, please contact the
sender by reply e-mail and destroy all copies of the original message. Any
unauthorised review, use, disclosure, dissemination, forwarding, printing or
copying of this email or any action taken in reliance on this e-mail is
strictly prohibited and may be unlawful.
Visit us @ http://www.masconit.com





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


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



Re: File Upload and Request Parameter

2003-08-29 Thread Jason Lea
David Stemm wrote:

All,
   I have a form that is doing a file upload and on the confirmation page after the upload I'm trying to get a request parameter using 
the c:out tag.  The tag doesn't seem to find the request param.  I know the parameter exists - I can see it in the debugger.  
The tag looks like this: c:out value=${param.action}/ and I tried this as well c:out 
value=${param['action']}/.  I believe the problem is because the form is setup to use multipart/form-data. 
 Any ideas on this?  Thanks.
There is a note in the request.getParameter() JavaDocs that states:

If the parameter data was sent in the request body, such as occurs with 
an HTTP POST request, then reading the body directly via 
getInputStream() or getReader() can interfere with the execution of this 
method.

You have probably used some package like FileUpload to handle the file. 
 This package would be using the getInputStream() to extract the 
contents of the uploaded file (this is why you cannot access the 
parameters normally).  This package should also provide some method of 
accessing any formfields or parameters that were passed.

FileUpload package:
http://jakarta.apache.org/commons/fileupload
(I haven't used this myself) It looks like you could use this in your 
action to get a list of FileItems (some will be uploaded files which you 
can save to disk, the others would be form fields).

When you find a form field, you could try adding it to the request using 
request.setAttribute(), which should allow you to access it using c:out.

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


RE: Looking for Multiple file upload at once example

2003-08-28 Thread David Friedman
And the answer to my own question isRTFM better!

I caused my own problem.  The form can populate
files if you set the form field to type FormFile,
not String as I was using.  That stopped my
crashing so I expect I'll have just as easy a time
getting to the uploaded files name and data. :)

Sorry to bother the list. And shame on me. :(

David

-Original Message-
From: David Friedman [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 27, 2003 11:52 PM
To: [EMAIL PROTECTED]
Subject: Looking for Multiple file upload at once example


I'm drawing a blank looking for an example of
uploading 2 or more files at once in Struts 1.1.
I'm trying to load 3 pics at once: image,
bgImage, and logo. I have String setter's in my
ActionFrom so I can store the name of the files,
and I'm setting my form enctype to
multipart/form-data.  I did that, and now,
before I can try to find a way to obtain the
MulitPartRequestHandler, it crashes with an Exception
(see past my ramblings for it).

For the 3 file uploads, I was going to the ActionForm's
getMultiPartRequestHandler() but I'm not sure what
to do with it.. Should I put it in the validate? Should
I get the form.getMultiPartRequestHandler() from within
the Action and then use getFileElements() to obtain a
hash of FileForms?

Does anyone have any suggestions?  The struts-upload
example I have was for one file, I found nothing
appropriate on the list archives, and the jakarta
site didn't seem to show me what I was hoping for...
Also, the I found a doc that said the enctype should
be mutilpart/request-data. I hope that's a typo
since a) it didn't seem to upload anything (the update
went in an instant) and b) I've never heard of
multipart/request-data before and can't find it
searching via google.  That odd reference is in the
Struts 1.1 final API's ActionForm page under the
description for getMultiPartRequestHandler(), page:
http://jakarta.apache.org/struts/api/org/apache/struts/action/ActionForm.htm
l

Thanks for any suggestions and below is my evil
stack trace from when I switched my enctype to
mutilpart/form-data and tried sending the form
in to Struts 1.1 (Tomcat 4.1.27/JDK 1.4.2)

Regards,
David

javax.servlet.ServletException: BeanUtils.populate
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j
ava:821)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:256)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:171)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480

Looking for Multiple file upload at once example

2003-08-28 Thread David Friedman
I'm drawing a blank looking for an example of
uploading 2 or more files at once in Struts 1.1.
I'm trying to load 3 pics at once: image,
bgImage, and logo. I have String setter's in my
ActionFrom so I can store the name of the files,
and I'm setting my form enctype to
multipart/form-data.  I did that, and now,
before I can try to find a way to obtain the
MulitPartRequestHandler, it crashes with an Exception
(see past my ramblings for it).

For the 3 file uploads, I was going to the ActionForm's
getMultiPartRequestHandler() but I'm not sure what
to do with it.. Should I put it in the validate? Should
I get the form.getMultiPartRequestHandler() from within
the Action and then use getFileElements() to obtain a
hash of FileForms?

Does anyone have any suggestions?  The struts-upload
example I have was for one file, I found nothing
appropriate on the list archives, and the jakarta
site didn't seem to show me what I was hoping for...
Also, the I found a doc that said the enctype should
be mutilpart/request-data. I hope that's a typo
since a) it didn't seem to upload anything (the update
went in an instant) and b) I've never heard of
multipart/request-data before and can't find it
searching via google.  That odd reference is in the
Struts 1.1 final API's ActionForm page under the
description for getMultiPartRequestHandler(), page:
http://jakarta.apache.org/struts/api/org/apache/struts/action/ActionForm.htm
l

Thanks for any suggestions and below is my evil
stack trace from when I switched my enctype to
mutilpart/form-data and tried sending the form
in to Struts 1.1 (Tomcat 4.1.27/JDK 1.4.2)

Regards,
David

javax.servlet.ServletException: BeanUtils.populate
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j
ava:821)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:256)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:171)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:263)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:360)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:604)
at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:562)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:679)

RE: Looking for Multiple file upload at once example

2003-08-28 Thread Andrew Hill
I posted something about this a week or two back outlining a technique
whereby, although the user can still only upload one file (per field) at a
time, the form is session scoped and keeps track of already uploaded files
internally, so over a series of requests the user can upload multiple files
for a particular field, prior to passing the whole lot on to the action for
processing.

Ill post a few more details in a couple of minutes, but right now I just got
out of a meeting and theres a cigerette with my name on it asking me to
smoke it before I do anything further... ;-)

-Original Message-
From: David Friedman [mailto:[EMAIL PROTECTED]
Sent: Thursday, 28 August 2003 11:52
To: [EMAIL PROTECTED]
Subject: Looking for Multiple file upload at once example


I'm drawing a blank looking for an example of
uploading 2 or more files at once in Struts 1.1.
I'm trying to load 3 pics at once: image,
bgImage, and logo. I have String setter's in my
ActionFrom so I can store the name of the files,
and I'm setting my form enctype to
multipart/form-data.  I did that, and now,
before I can try to find a way to obtain the
MulitPartRequestHandler, it crashes with an Exception
(see past my ramblings for it).

For the 3 file uploads, I was going to the ActionForm's
getMultiPartRequestHandler() but I'm not sure what
to do with it.. Should I put it in the validate? Should
I get the form.getMultiPartRequestHandler() from within
the Action and then use getFileElements() to obtain a
hash of FileForms?

Does anyone have any suggestions?  The struts-upload
example I have was for one file, I found nothing
appropriate on the list archives, and the jakarta
site didn't seem to show me what I was hoping for...
Also, the I found a doc that said the enctype should
be mutilpart/request-data. I hope that's a typo
since a) it didn't seem to upload anything (the update
went in an instant) and b) I've never heard of
multipart/request-data before and can't find it
searching via google.  That odd reference is in the
Struts 1.1 final API's ActionForm page under the
description for getMultiPartRequestHandler(), page:
http://jakarta.apache.org/struts/api/org/apache/struts/action/ActionForm.htm
l

Thanks for any suggestions and below is my evil
stack trace from when I switched my enctype to
mutilpart/form-data and tried sending the form
in to Struts 1.1 (Tomcat 4.1.27/JDK 1.4.2)

Regards,
David

javax.servlet.ServletException: BeanUtils.populate
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j
ava:821)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:256)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:171)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174

RE: Looking for Multiple file upload at once example

2003-08-28 Thread Andrew Hill
snip
The form can populate files if you set the form field to type FormFile,
not String as I was using.
/snip

Ah glad to hear you got it working. Having read your question closer this
time I guess that you are providing 3 seperate file upload controls for the
files, so the info I was posting isn't applicable in this case, (Being about
how to associate any number of files with a single field), so I'll leave off
on the details of that unless anyone else is interested in having them
posted again?

-Original Message-
From: Andrew Hill [mailto:[EMAIL PROTECTED]
Sent: Thursday, 28 August 2003 15:18
To: Struts Users Mailing List
Subject: RE: Looking for Multiple file upload at once example


I posted something about this a week or two back outlining a technique
whereby, although the user can still only upload one file (per field) at a
time, the form is session scoped and keeps track of already uploaded files
internally, so over a series of requests the user can upload multiple files
for a particular field, prior to passing the whole lot on to the action for
processing.

Ill post a few more details in a couple of minutes, but right now I just got
out of a meeting and theres a cigerette with my name on it asking me to
smoke it before I do anything further... ;-)

-Original Message-
From: David Friedman [mailto:[EMAIL PROTECTED]
Sent: Thursday, 28 August 2003 11:52
To: [EMAIL PROTECTED]
Subject: Looking for Multiple file upload at once example


I'm drawing a blank looking for an example of
uploading 2 or more files at once in Struts 1.1.
I'm trying to load 3 pics at once: image,
bgImage, and logo. I have String setter's in my
ActionFrom so I can store the name of the files,
and I'm setting my form enctype to
multipart/form-data.  I did that, and now,
before I can try to find a way to obtain the
MulitPartRequestHandler, it crashes with an Exception
(see past my ramblings for it).

For the 3 file uploads, I was going to the ActionForm's
getMultiPartRequestHandler() but I'm not sure what
to do with it.. Should I put it in the validate? Should
I get the form.getMultiPartRequestHandler() from within
the Action and then use getFileElements() to obtain a
hash of FileForms?

Does anyone have any suggestions?  The struts-upload
example I have was for one file, I found nothing
appropriate on the list archives, and the jakarta
site didn't seem to show me what I was hoping for...
Also, the I found a doc that said the enctype should
be mutilpart/request-data. I hope that's a typo
since a) it didn't seem to upload anything (the update
went in an instant) and b) I've never heard of
multipart/request-data before and can't find it
searching via google.  That odd reference is in the
Struts 1.1 final API's ActionForm page under the
description for getMultiPartRequestHandler(), page:
http://jakarta.apache.org/struts/api/org/apache/struts/action/ActionForm.htm
l

Thanks for any suggestions and below is my evil
stack trace from when I switched my enctype to
mutilpart/form-data and tried sending the form
in to Struts 1.1 (Tomcat 4.1.27/JDK 1.4.2)

Regards,
David

javax.servlet.ServletException: BeanUtils.populate
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j
ava:821)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:256)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext

File Upload and Request Parameter

2003-08-28 Thread David Stemm
All,
   I have a form that is doing a file upload and on the confirmation page after the 
upload I'm trying to get a request parameter using the c:out tag.  The tag doesn't 
seem to find the request param.  I know the parameter exists - I can see it in the 
debugger.  The tag looks like this: c:out value=${param.action}/ and I tried this 
as well c:out value=${param['action']}/.  I believe the problem is because the 
form is setup to use multipart/form-data.  Any ideas on this?  Thanks.

File Upload and Request Parameter

2003-08-28 Thread David Stemm
All,
   I have a form that is doing a file upload and on the confirmation page after the 
upload I'm trying to get a request parameter using the c:out tag.  The tag doesn't 
seem to find the request param.  I know the parameter exists - I can see it in the 
debugger.  The tag looks like this: c:out value=${param.action}/ and I tried this 
as well c:out value=${param['action']}/.  I believe the problem is because the 
form is setup to use multipart/form-data.  Any ideas on this?  Thanks.

File Upload error

2003-08-21 Thread Erez Efrati
Hi,

I am trying to do file uploading of several files and I keep getting the
following error:

java.lang.NoSuchMethodError:
org.apache.commons.fileupload.MultipartStream.setHeaderEncoding(Ljava/la
ng/String;)V

I am using JBoss/Tomcat 4.1.24. The upload struts sample works just fine
under 4.1.27 - I haven't tried it under 4.1.24.

Does anyone have a clue?

Thanks,
Erez



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



RE: File Upload error

2003-08-21 Thread Alex Shneyderman
Make sure you do not have another file upload jar in your classpath.

Where are you hosting your app, what OS?

Alex.

 -Original Message-
 From: Erez Efrati [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 21, 2003 11:14 AM
 To: 'Struts Users Mailing List'
 Subject: File Upload error
 
 Hi,
 
 I am trying to do file uploading of several files and I keep getting
the
 following error:
 
 java.lang.NoSuchMethodError:

org.apache.commons.fileupload.MultipartStream.setHeaderEncoding(Ljava/la
 ng/String;)V
 
 I am using JBoss/Tomcat 4.1.24. The upload struts sample works just
fine
 under 4.1.27 - I haven't tried it under 4.1.24.
 
 Does anyone have a clue?
 
 Thanks,
 Erez
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



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



RE: File Upload error

2003-08-21 Thread Erez Efrati
Alex, 

I found it!! It was a beta version of the FileUpload in the
JBoss/Tomcat-4.1.24. I just replaced it with the FileUpload 1.0 that
came with Struts and it works now, thank god :)

Erez

-Original Message-
From: Alex Shneyderman [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 21, 2003 4:48 PM
To: 'Struts Users Mailing List'
Subject: RE: File Upload error

Make sure you do not have another file upload jar in your classpath.

Where are you hosting your app, what OS?

Alex.

 -Original Message-
 From: Erez Efrati [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 21, 2003 11:14 AM
 To: 'Struts Users Mailing List'
 Subject: File Upload error
 
 Hi,
 
 I am trying to do file uploading of several files and I keep getting
the
 following error:
 
 java.lang.NoSuchMethodError:

org.apache.commons.fileupload.MultipartStream.setHeaderEncoding(Ljava/la
 ng/String;)V
 
 I am using JBoss/Tomcat 4.1.24. The upload struts sample works just
fine
 under 4.1.27 - I haven't tried it under 4.1.24.
 
 Does anyone have a clue?
 
 Thanks,
 Erez
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



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



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



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 commands, e-mail: [EMAIL PROTECTED]

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

File Upload Data

2003-08-20 Thread Steven Leija
Hello All,

I'm running into a really weird problem.  I'm uploading a file in windows and the 
input stream is just fine.  But when I deploy my application to a linux box, the same 
upload failes.  I traced this down to the fact that the input stream is empty.  The 
file is being uploaded but the stream is coming in as null.  I've verified these files 
are not corrupt or empty.  

Has anyone seen this before?

Thanks,

Steven

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

RE: file upload 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 url-path
dir-path in Apache. I don't see why it is not there, am I the only one
to deal with this kind of requirement? I guess not :) 

Regards,
Erez



-Original Message-
From: Brian McSweeney [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 20, 2003 11:59 AM
To: 'Struts Users Mailing List'
Subject: RE: file upload problem


Hi Erez,

Just wondering if you figured this out. I've found what I think could 
be a solution.

If you deploy your jboss ear in an exploded way:

[
How can a war file be deployed in a exploded way .. 

just create a directory named foo.ear and in the deploy
directory,
and unpack your EAR file in foo.ear.
Then unpack the WAR file in a directory named foo.war in
foo.ear.
]

then you can write the uploaded files to a folder that the tomcat server

will be able to serve!

This works for me. Email me for more details.
Brian



-Original Message-
From: Erez Efrati [mailto:[EMAIL PROTECTED] 
Sent: 18 August 2003 15:53
To: 'Struts Users Mailing List'
Subject: RE: file upload problem

I am dealing as well with the file upload issue:

1) To where should I save those files. For one I haven't done this, so
this is all new. Also, I am using JBoss and I saw that no matter which
directory I choose under my application context directory, this
directory will be deleted and recreated upon redeployment so I guess
there is a convention that I am not aware of. If I go and save my files
in a c:\files how could links from JSP access those files. Lost in the
wilderness :) How is it done?

2) I could always store those files in the database but then I would
have to access them through an action, is this wise?

Thanks a bunch,
Erez

-Original Message-
From: Brian McSweeney [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 18, 2003 3:46 PM
To: 'Struts Users Mailing List'
Subject: RE: file upload problem

Shane,

You are a star! That fixed it!

Thanks very much,
Brian

-Original Message-
From: Witbeck, Shane [mailto:[EMAIL PROTECTED] 
Sent: 18 August 2003 14:17
To: [EMAIL PROTECTED]
Subject: RE: file upload problem

I had a similar problem until I realized that you must specify a file
and
not a folder for the upload path (i.e. /tmp/upload/upload.txt not
/tmp/upload). 

HTH,

Shane

-Original Message-
From: Brian McSweeney [mailto:[EMAIL PROTECTED]
Sent: Monday, August 18, 2003 7:24 AM
To: 'Struts Users Mailing List'
Subject: RE: file upload problem


Thanks Prashanth,
But I don't think that's the problem.
Thanks anyway though,
Brian

-Original Message-
From: Prashanth.S [mailto:[EMAIL PROTECTED] 
Sent: 18 August 2003 11:44
To: Struts Users Mailing List
Subject: Re: file upload problem

hi brian,
try changing the folder permission from read-only??Its just a guess
Thanks
Prashanth


Brian McSweeney [EMAIL PROTECTED] wrote:
Hi all,

I'm trying to do a file upload action based on the example
struts-upload.war.

I want to save the uploaded file to a folder on disk. However when I try
to run 
the action I get

Re: File Upload Data

2003-08-20 Thread David G. Friedman
Steven,

I had a problem like that where nothing was being uploaded because my form enctype was 
not set to 'multipart/form-data'.  Then again, the problem was when I was programming 
in Perl under Apache + NT and migrating it to Perl under Apache + Linux, so it's not 
quite the Struts-Upload related answer you were probably looking for, huh? :(

Regards,
David

---Original Message---
From: Steven Leija [EMAIL PROTECTED]
Sent: 08/20/03 08:58 AM
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: File Upload Data

 
 Hello All,

I'm running into a really weird problem.  I'm uploading a file in windows
and the input stream is just fine.  But when I deploy my application to a
linux box, the same upload failes.  I traced this down to the fact that the
input stream is empty.  The file is being uploaded but the stream is coming 
in as null.  I've verified these files are not corrupt or empty.  

Has anyone seen this before?

Thanks,

Steven

 

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



Re: File Upload Data

2003-08-20 Thread Shane Witbeck
I have run the same code for my file uploads in windows and linux without a
problem.

Shane


- Original Message - 
From: David G. Friedman [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Wednesday, August 20, 2003 7:13 AM
Subject: Re: File Upload Data


 Steven,

 I had a problem like that where nothing was being uploaded because my form
enctype was not set to 'multipart/form-data'.  Then again, the problem was
when I was programming in Perl under Apache + NT and migrating it to Perl
under Apache + Linux, so it's not quite the Struts-Upload related answer you
were probably looking for, huh? :(

 Regards,
 David

 ---Original Message---
 From: Steven Leija [EMAIL PROTECTED]
 Sent: 08/20/03 08:58 AM
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Subject: File Upload Data

 
  Hello All,

 I'm running into a really weird problem.  I'm uploading a file in windows
 and the input stream is just fine.  But when I deploy my application to a
 linux box, the same upload failes.  I traced this down to the fact that
the
 input stream is empty.  The file is being uploaded but the stream is
coming
 in as null.  I've verified these files are not corrupt or empty.

 Has anyone seen this before?

 Thanks,

 Steven

 

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




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



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]



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]



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]



  1   2   3   4   >