Advice on File Uplaod

2003-03-12 Thread John Brayton
I am somewhat of a Struts newbie, and I could use some advice on 
implementing a component of an application.

I have a form that allows a user to upload a file, along with 
associated meta-data.  If the form's validate() method returns 
ActionErrors, the form will keep the originally entered fields as 
default values so that the user can just fix his or her errors and 
continue.

Is there a facility to do something similar with a file?  I don't 
really want to  have the file transmitted back and forth in the case 
of a form validation error, and there does not seem to be a mechanism 
in HTML for including an entire file as a default value anyway.  But 
I do not want the user to need to re-select the file from the file 
system just because one or more of the meta-data fields has a 
validation error.

Any thoughts on how to go about this?

Thanks!

John

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


Re: Advice on File Uplaod

2003-03-12 Thread Dan Tran
I have the same problem but unable to find solution yet, except to validate
as much as I can in the browser side so that I can retain the file field.

-Dan

- Original Message -
From: John Brayton [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 5:48 PM
Subject: Advice on File Uplaod


 I am somewhat of a Struts newbie, and I could use some advice on
 implementing a component of an application.

 I have a form that allows a user to upload a file, along with
 associated meta-data.  If the form's validate() method returns
 ActionErrors, the form will keep the originally entered fields as
 default values so that the user can just fix his or her errors and
 continue.

 Is there a facility to do something similar with a file?  I don't
 really want to  have the file transmitted back and forth in the case
 of a form validation error, and there does not seem to be a mechanism
 in HTML for including an entire file as a default value anyway.  But
 I do not want the user to need to re-select the file from the file
 system just because one or more of the meta-data fields has a
 validation error.

 Any thoughts on how to go about this?

 Thanks!

 John

 -
 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: Advice on File Uplaod

2003-03-12 Thread Brandon Goodin
Validate with javascript before the submit. That is the only way. There is
no means to pass the file reference back to the page.

Brandon Goodin
Phase Web and Multimedia
PO Box 85
Whitefish MT 59937
P (406) 862-2245
F (406) 862-0354
[EMAIL PROTECTED]
http://www.phase.ws


-Original Message-
From: Dan Tran [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 7:09 PM
To: Struts Users Mailing List
Subject: Re: Advice on File Uplaod


I have the same problem but unable to find solution yet, except to validate
as much as I can in the browser side so that I can retain the file field.

-Dan

- Original Message -
From: John Brayton [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 5:48 PM
Subject: Advice on File Uplaod


 I am somewhat of a Struts newbie, and I could use some advice on
 implementing a component of an application.

 I have a form that allows a user to upload a file, along with
 associated meta-data.  If the form's validate() method returns
 ActionErrors, the form will keep the originally entered fields as
 default values so that the user can just fix his or her errors and
 continue.

 Is there a facility to do something similar with a file?  I don't
 really want to  have the file transmitted back and forth in the case
 of a form validation error, and there does not seem to be a mechanism
 in HTML for including an entire file as a default value anyway.  But
 I do not want the user to need to re-select the file from the file
 system just because one or more of the meta-data fields has a
 validation error.

 Any thoughts on how to go about this?

 Thanks!

 John

 -
 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: Advice on File Uplaod

2003-03-12 Thread Peter Gershkovich
There could be another way.
You may probably save the file first with the sessionID in a temp 
folder. Save the path to the session and use it when the file field is null.
I believe that should  work.

Brandon Goodin wrote:
Validate with javascript before the submit. That is the only way. There is
no means to pass the file reference back to the page.
Brandon Goodin
Phase Web and Multimedia
PO Box 85
Whitefish MT 59937
P (406) 862-2245
F (406) 862-0354
[EMAIL PROTECTED]
http://www.phase.ws
-Original Message-
From: Dan Tran [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 7:09 PM
To: Struts Users Mailing List
Subject: Re: Advice on File Uplaod
I have the same problem but unable to find solution yet, except to validate
as much as I can in the browser side so that I can retain the file field.
-Dan

- Original Message -
From: John Brayton [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 5:48 PM
Subject: Advice on File Uplaod


I am somewhat of a Struts newbie, and I could use some advice on
implementing a component of an application.
I have a form that allows a user to upload a file, along with
associated meta-data.  If the form's validate() method returns
ActionErrors, the form will keep the originally entered fields as
default values so that the user can just fix his or her errors and
continue.
Is there a facility to do something similar with a file?  I don't
really want to  have the file transmitted back and forth in the case
of a form validation error, and there does not seem to be a mechanism
in HTML for including an entire file as a default value anyway.  But
I do not want the user to need to re-select the file from the file
system just because one or more of the meta-data fields has a
validation error.
Any thoughts on how to go about this?

Thanks!

John

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


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


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



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


Re: Advice on File Uplaod

2003-03-12 Thread Dan Tran
Agree.

The reason why there is no way to retain the file name after server side
validation fail, is security.

Imagine this, the server side can make the File field hidden
and automatically submit the form so that it retrieve a file on your browser
computer.

-Dan

- Original Message -
From: Brandon Goodin [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 7:42 PM
Subject: RE: Advice on File Uplaod


 Validate with javascript before the submit. That is the only way. There is
 no means to pass the file reference back to the page.

 Brandon Goodin
 Phase Web and Multimedia
 PO Box 85
 Whitefish MT 59937
 P (406) 862-2245
 F (406) 862-0354
 [EMAIL PROTECTED]
 http://www.phase.ws


 -Original Message-
 From: Dan Tran [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 12, 2003 7:09 PM
 To: Struts Users Mailing List
 Subject: Re: Advice on File Uplaod


 I have the same problem but unable to find solution yet, except to
validate
 as much as I can in the browser side so that I can retain the file field.

 -Dan

 - Original Message -
 From: John Brayton [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, March 12, 2003 5:48 PM
 Subject: Advice on File Uplaod


  I am somewhat of a Struts newbie, and I could use some advice on
  implementing a component of an application.
 
  I have a form that allows a user to upload a file, along with
  associated meta-data.  If the form's validate() method returns
  ActionErrors, the form will keep the originally entered fields as
  default values so that the user can just fix his or her errors and
  continue.
 
  Is there a facility to do something similar with a file?  I don't
  really want to  have the file transmitted back and forth in the case
  of a form validation error, and there does not seem to be a mechanism
  in HTML for including an entire file as a default value anyway.  But
  I do not want the user to need to re-select the file from the file
  system just because one or more of the meta-data fields has a
  validation error.
 
  Any thoughts on how to go about this?
 
  Thanks!
 
  John
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 

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



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


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



RE: Advice on File Uplaod

2003-03-12 Thread Andrew Hill
We do something a little more complicated to deal with this situation.
Since the file is uploaded when they submit, if they need to go back because
of validation errors, our form keeps a reference to the uploaded file, and
instead of showing a file upload box again it shows the name of the file as
text.

We have actually developed a rather complex 'widget' that allows us to
represent 'file fields' that can have multiple files associated with the
field - the list of files already uploaded to that field is shown as text
with checkboxes to allow user to select files to remove and a file upload
box to allow more to be added (one at a time unfortunately). Theres also a
button that invokes a round trip to the server to cause the upload or
removal of files (For fields that only allow one file, uploading another
file replaces the first).

Our base actionForm class contains various utility methods to keep track of
what files are uploaded etc... and these methods are invoked from the
relevant getters and setters (and there are a couple needed for each such
field - for uploading the formfile, for the list of files to trash, etc...)

Our file handling code heavily depends on other rather wierd ways in which
we (ab)use struts so theres not much point in posting it, but hopefully Ive
given you some ideas you can use.

-Original Message-
From: Peter Gershkovich [mailto:[EMAIL PROTECTED]
Sent: Thursday, 13 March 2003 11:53
To: Struts Users Mailing List
Subject: Re: Advice on File Uplaod


There could be another way.
You may probably save the file first with the sessionID in a temp
folder. Save the path to the session and use it when the file field is null.
I believe that should  work.

Brandon Goodin wrote:
 Validate with javascript before the submit. That is the only way. There is
 no means to pass the file reference back to the page.

 Brandon Goodin
 Phase Web and Multimedia
 PO Box 85
 Whitefish MT 59937
 P (406) 862-2245
 F (406) 862-0354
 [EMAIL PROTECTED]
 http://www.phase.ws


 -Original Message-
 From: Dan Tran [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 12, 2003 7:09 PM
 To: Struts Users Mailing List
 Subject: Re: Advice on File Uplaod


 I have the same problem but unable to find solution yet, except to
validate
 as much as I can in the browser side so that I can retain the file field.

 -Dan

 - Original Message -
 From: John Brayton [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, March 12, 2003 5:48 PM
 Subject: Advice on File Uplaod



I am somewhat of a Struts newbie, and I could use some advice on
implementing a component of an application.

I have a form that allows a user to upload a file, along with
associated meta-data.  If the form's validate() method returns
ActionErrors, the form will keep the originally entered fields as
default values so that the user can just fix his or her errors and
continue.

Is there a facility to do something similar with a file?  I don't
really want to  have the file transmitted back and forth in the case
of a form validation error, and there does not seem to be a mechanism
in HTML for including an entire file as a default value anyway.  But
I do not want the user to need to re-select the file from the file
system just because one or more of the meta-data fields has a
validation error.

Any thoughts on how to go about this?

Thanks!

John

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



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



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





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


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



RE: Advice on File Uplaod

2003-03-12 Thread Daniel Joshua
lol... nice reply... did not see it when I replied.

Regards,
Daniel


-Original Message-
From: Andrew Hill [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 13, 2003 12:12 PM
To: Struts Users Mailing List
Subject: RE: Advice on File Uplaod


We do something a little more complicated to deal with this situation.
Since the file is uploaded when they submit, if they need to go back because
of validation errors, our form keeps a reference to the uploaded file, and
instead of showing a file upload box again it shows the name of the file as
text.

We have actually developed a rather complex 'widget' that allows us to
represent 'file fields' that can have multiple files associated with the
field - the list of files already uploaded to that field is shown as text
with checkboxes to allow user to select files to remove and a file upload
box to allow more to be added (one at a time unfortunately). Theres also a
button that invokes a round trip to the server to cause the upload or
removal of files (For fields that only allow one file, uploading another
file replaces the first).

Our base actionForm class contains various utility methods to keep track of
what files are uploaded etc... and these methods are invoked from the
relevant getters and setters (and there are a couple needed for each such
field - for uploading the formfile, for the list of files to trash, etc...)

Our file handling code heavily depends on other rather wierd ways in which
we (ab)use struts so theres not much point in posting it, but hopefully Ive
given you some ideas you can use.

-Original Message-
From: Peter Gershkovich [mailto:[EMAIL PROTECTED]
Sent: Thursday, 13 March 2003 11:53
To: Struts Users Mailing List
Subject: Re: Advice on File Uplaod


There could be another way.
You may probably save the file first with the sessionID in a temp
folder. Save the path to the session and use it when the file field is null.
I believe that should  work.

Brandon Goodin wrote:
 Validate with javascript before the submit. That is the only way. There is
 no means to pass the file reference back to the page.

 Brandon Goodin
 Phase Web and Multimedia
 PO Box 85
 Whitefish MT 59937
 P (406) 862-2245
 F (406) 862-0354
 [EMAIL PROTECTED]
 http://www.phase.ws


 -Original Message-
 From: Dan Tran [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 12, 2003 7:09 PM
 To: Struts Users Mailing List
 Subject: Re: Advice on File Uplaod


 I have the same problem but unable to find solution yet, except to
validate
 as much as I can in the browser side so that I can retain the file field.

 -Dan

 - Original Message -
 From: John Brayton [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, March 12, 2003 5:48 PM
 Subject: Advice on File Uplaod



I am somewhat of a Struts newbie, and I could use some advice on
implementing a component of an application.

I have a form that allows a user to upload a file, along with
associated meta-data.  If the form's validate() method returns
ActionErrors, the form will keep the originally entered fields as
default values so that the user can just fix his or her errors and
continue.

Is there a facility to do something similar with a file?  I don't
really want to  have the file transmitted back and forth in the case
of a form validation error, and there does not seem to be a mechanism
in HTML for including an entire file as a default value anyway.  But
I do not want the user to need to re-select the file from the file
system just because one or more of the meta-data fields has a
validation error.

Any thoughts on how to go about this?

Thanks!

John

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



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



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





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


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