Hi Irshad,

Is there any major issue stopping you from using the normal Struts
FileUpload mechanism (ie: FormFile properties in your actionForm)?
As, it looks like you may need to handle the file yourself, in as much as
using the struts FormFile and from it get the file and copy it to the
appropriate destination yourself. (Struts will have already done the hard
work to parse the multipart request , and the formfile will supply you an
inputstream to read the file from).

<disclaimer>As mentioned , Im not familiar with the oracle fileuploadbean,
so can only give general suggestions here. There may well be a better way of
resolving the issue of which I am unaware!</disclaimer>

hth
Andrew

ps: hope you dont mind, Im also forwarding this reply to the struts user
list in case it can help anyone else who searches the archives for this
problem!

-----Original Message-----
From: Irshad Buchh [mailto:[EMAIL PROTECTED]
Sent: Thursday, 6 May 2004 20:04
To: '[EMAIL PROTECTED]'
Subject: RE: Problem with using HttpUploadBean with Struts
Importance: High


Hi there,

Do you have any possible work-around, please let me know.

Regards.
Irshad

-----Original Message-----
From: Andrew Hill [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 05, 2004 1:44 PM
To: Struts Users Mailing List
Subject: RE: Problem with using HttpUploadBean with Struts


I am not familiar with the oracle tags in question, but my guess is that the
problem is caused by the fact that struts will parse a multipart request so
that it can create a request wrapper from which to populate the actionform.
I reckon that whats happening is that when the bean in question tries itself
to parse the request (by reading from its inputstream) it fails as struts
has already read the stream.

Now it may be possible to hack around and stop struts from reading the
stream and creating the request wrapper, *but* I predict that a problem with
that (if it can be done practically) is that struts would not then be able
to populate your form bean (as without parsing the stream it cant get the
parameter values as the servlet api doesnt handle this for you when doing
multipart requests)



-----Original Message-----
From: Irshad Buchh [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 5 May 2004 18:43
To: [EMAIL PROTECTED]
Subject: Problem with using HttpUploadBean with Struts
Importance: High


Hi,

I am trying to use HttpUploadBean and HttpDownloadBean of the Oracle JSP Tag
Library ojsputil.jar in a Struts application, but no luck. Are there any
issues about using these beans with Struts Action Classes.
I am getting this error:

04/04/28 18:40:10 Corrupt form data: premature ending

04/04/28 18:40:10 at
oracle.jsp.webutil.fileaccess.HttpUploadBean.upload(HttpUploadBean.java:70)

04/04/28 18:40:10 at
bookstore.testing.struts.action.UploadAction.execute(UploadAction.java:51)

04/04/28 18:40:10 at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces
sor.java:484)

My form is like this:

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ page contentType="text/html;charset=windows-1252"%>
<html:html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>
<title>File Upload | Example</title>
<link href="<html:rewrite page="/css/style.css"/>" rel="stylesheet"
type="text/css"/>
<html:base/>
</head>
<body>
<html:form action="upload.do" enctype="multipart/form-data" method="POST">
<br/>
<bean:message key="label.filename"/>:
<input type="FILE" name="file" size="20" maxlength="50"/>
<!-- <html:file property="file" size="20" maxlength="40" /> -->
<br/>
<br/>
<html:submit>
<bean:message key="button.submit"/>
</html:submit>
<html:cancel>
<bean:message key="button.cancel"/>
</html:cancel>
</html:form>
</body>
</html:html>

Regards,

Irshad



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

Reply via email to