You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Gareth Coltman <ga...@majorband.co.uk> on 2001/06/22 16:57:03 UTC

RE: Upload service again

OK,

If I don't supply an image name, my form works perfectly and calls my action/event. If I do it never even gets to my action. Just
keeps printing Y's.

Any clues?

> -----Original Message-----
> From: Gareth Coltman [mailto:gareth_coltman@majorband.co.uk]
> Sent: Friday, June 22, 2001 15:44
> To: turbine-user@jakarta.apache.org
> Subject: RE: Upload service
>
>
> Oh, in addition, something (not my code) is writing Y on a newline to the console. It looks as if there is a Y for every form
> element.???!!!
>
> Gareth
>
> > -----Original Message-----
> > From: Gareth Coltman [mailto:gareth_coltman@majorband.co.uk]
> > Sent: Friday, June 22, 2001 15:37
> > To: turbine-user@jakarta.apache.org
> > Subject: Upload service
> >
> >
> > Help!
> >
> > I am trying to use turbine's imageupload service for the first time.
> >
> > My form header looks like this
> >
> > <form enctype="multipart/form-data" name="stage3" id="stage3" method="post">
> > 	<input type="hidden" name="action" value="myAction">
> >
> > and contains a mixture of form elements, some text, textarea etc, and two "file" elements.
> >
> > I specify my event in the submit button
> >
> > I have two problems:
> >
> > 1. My action is never reached (not even doPerform)
> > 2. It seems that the uploadservice is writing all the form data to the disk, not just the files.
> >
> > Has anyone successfully used the upload service on a form with a mixture of html input types?
> >
> > Gareth
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: turbine-user-help@jakarta.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: Upload service again

Posted by Daniel Rall <dl...@finemaltcoding.com>.
"Gareth Coltman" <ga...@majorband.co.uk> writes:

> OK thanks,
> 
> More info:
> 
> My form uses an image button to submit (shouldn't make any difference but...)
> 
> There are two file elements in my form.
> 
> As I said parsing parameters works no problem if a don't specify a file. When I do, all I get is Y's in the console. At the mo I
> haven't got a decent IDE to debug so I am stuck.

import org.apache.turbine.util.Log;

Log.debug(...);

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


RE: Upload service again

Posted by Gareth Coltman <ga...@majorband.co.uk>.
> 
> Take a look at:
> 
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=526
> 

Yes, this is exactly my problem.

> I've been using multipart/form-data uploads and they have been working after
> fixing a few bugs in the older version of the TDK we are using.  If you are
> using an older version of the TDK, you may want to consider upgrading.

Is there anyway to resolve this issue without switching back to an older version of ajp?

Any help would be much appreciated

Gareth

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


RE: Upload service again

Posted by Myron Ahn <my...@yahoo.com>.
This sounds a lot like some of the bugs with multipart/form-data that are in
the bug database.

Take a look at:

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

I've been using multipart/form-data uploads and they have been working after
fixing a few bugs in the older version of the TDK we are using.  If you are
using an older version of the TDK, you may want to consider upgrading.

Don't forget to set:

services.TurbineUploadService.automatic=true

You might also want to play with your upload size threshold:

services.TurbineUploadService.size.threshold=1048576

This is the threshold of the size of your file upload before it is written
to disk.

Note that a file can either be cached in memory or written to disk, and each
case needs to be handled accordingly.

FileItem fileitem = data.getParameters().getFileItem("image");
if (fileitem == null)
{
    throw new Exception("No Image specified");
}
File file = fileitem.getStoreLocation();
if (file == null)
{
    InputStream is = fileitem.getStream();
    FileOutputStream fos = new FileOutputStream(destPath);
    // copy the input stream to the output stream...
}
else
{
    file.renameTo(new File(destPath));
}

Hope it helps,
-Myron

> -----Original Message-----
> From: Gareth Coltman [mailto:gareth_coltman@majorband.co.uk]
> Sent: Friday, June 22, 2001 9:07 AM
> To: turbine-user@jakarta.apache.org
> Subject: RE: Upload service again
>
>
> OK thanks,
>
> More info:
>
> My form uses an image button to submit (shouldn't make any
> difference but...)
>
> There are two file elements in my form.
>
> As I said parsing parameters works no problem if a don't specify
> a file. When I do, all I get is Y's in the console. At the mo I
> haven't got a decent IDE to debug so I am stuck.
>
> Gareth
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


RE: Upload service again

Posted by Gareth Coltman <ga...@majorband.co.uk>.
OK thanks,

More info:

My form uses an image button to submit (shouldn't make any difference but...)

There are two file elements in my form.

As I said parsing parameters works no problem if a don't specify a file. When I do, all I get is Y's in the console. At the mo I
haven't got a decent IDE to debug so I am stuck.

Gareth


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: Upload service again

Posted by Jason van Zyl <jv...@apache.org>.
On 6/22/01 10:57 AM, "Gareth Coltman" <ga...@majorband.co.uk>
wrote:

> OK,
> 
> If I don't supply an image name, my form works perfectly and calls my
> action/event. If I do it never even gets to my action. Just
> keeps printing Y's.

I will add some more fields to the upload example in the TDK
sample app and see if I can reproduce your error to try
and help.
 
> Any clues?

Not yet.
 
>> -----Original Message-----
>> From: Gareth Coltman [mailto:gareth_coltman@majorband.co.uk]
>> Sent: Friday, June 22, 2001 15:44
>> To: turbine-user@jakarta.apache.org
>> Subject: RE: Upload service
>> 
>> 
>> Oh, in addition, something (not my code) is writing Y on a newline to the
>> console. It looks as if there is a Y for every form
>> element.???!!!
>> 
>> Gareth
>> 
>>> -----Original Message-----
>>> From: Gareth Coltman [mailto:gareth_coltman@majorband.co.uk]
>>> Sent: Friday, June 22, 2001 15:37
>>> To: turbine-user@jakarta.apache.org
>>> Subject: Upload service
>>> 
>>> 
>>> Help!
>>> 
>>> I am trying to use turbine's imageupload service for the first time.
>>> 
>>> My form header looks like this
>>> 
>>> <form enctype="multipart/form-data" name="stage3" id="stage3" method="post">
>>> <input type="hidden" name="action" value="myAction">
>>> 
>>> and contains a mixture of form elements, some text, textarea etc, and two
>>> "file" elements.
>>> 
>>> I specify my event in the submit button
>>> 
>>> I have two problems:
>>> 
>>> 1. My action is never reached (not even doPerform)
>>> 2. It seems that the uploadservice is writing all the form data to the disk,
>>> not just the files.
>>> 
>>> Has anyone successfully used the upload service on a form with a mixture of
>>> html input types?
>>> 
>>> Gareth
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>>> 
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>> 
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org

-- 

jvz.

http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org