You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by depub2 <de...@mxsi.com> on 2004/01/12 23:55:14 UTC

Action to move/copy file from temporary upload directory.

I am trying to use the upload feature in Cocoon. I
understand the default upload mechanism which uploads to a
temporary directory and requires the file to be copied or
moved before the request ends. I can get a file to upload to
the temporary directory.

THE QUESTION IS: How do I move/copy the file without
dropping into some custom java code or xsp? Isn't there a
cocoon action like "copy-file"? Do I really have to drop all
the way down to custom java/xsp to do something simple like
move a file?

Thanks so much!!

David




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Action to move/copy file from temporary upload directory.

Posted by Guido Casper <gc...@s-und-n.de>.
depub2 wrote:
> I am trying to use the upload feature in Cocoon. I
> understand the default upload mechanism which uploads to a
> temporary directory and requires the file to be copied or
> moved before the request ends. I can get a file to upload to
> the temporary directory.
>
> THE QUESTION IS: How do I move/copy the file without
> dropping into some custom java code or xsp? Isn't there a
> cocoon action like "copy-file"?

There is
http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/java/org/apache/cocoon/acting/CopySourceAction.java

Guido


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: Action to move/copy file from temporary upload directory.

Posted by depub2 <de...@mxsi.com>.
Uh, please do not take offense, but this *looks* like custom
java code...
just to do what supposedly is supported in the framework -
upload a simple file
to a specified location.


-----Original Message-----
From: news [mailto:news@sea.gmane.org]On Behalf Of Jorg
Heymans
Sent: Tuesday, January 13, 2004 12:41 AM
To: users@cocoon.apache.org
Subject: Re: Action to move/copy file from temporary upload
directory.


you don't need to store it in the temporary upload directory
first.
You can get an inputstream on the filepartarray in the
action.

Enumeration enum = request.getParameterNames();

   while (enum.hasMoreElements()) {
     String parameterName = (String)enum.nextElement();
     Object imageParamValue = request.get(parameterName);

     //is it an attached file
     if (imageParamValue instanceof FilePart) {
     FilePartArray fpa =
(FilePartArray)request.get(parameterName);

     ByteArrayInputStream bais =

(ByteArrayInputStream)fpa.getInputStream();
     .........

depub2 wrote:
> I am trying to use the upload feature in Cocoon. I
> understand the default upload mechanism which uploads to a
> temporary directory and requires the file to be copied or
> moved before the request ends. I can get a file to upload
to
> the temporary directory.
>
> THE QUESTION IS: How do I move/copy the file without
> dropping into some custom java code or xsp? Isn't there a
> cocoon action like "copy-file"? Do I really have to drop
all
> the way down to custom java/xsp to do something simple
like
> move a file?
>
> Thanks so much!!
>
> David


------------------------------------------------------------
---------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail:
users-help@cocoon.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Action to move/copy file from temporary upload directory.

Posted by Jorg Heymans <jh...@domek.be>.
you don't need to store it in the temporary upload directory first.
You can get an inputstream on the filepartarray in the action.

Enumeration enum = request.getParameterNames();

   while (enum.hasMoreElements()) {
     String parameterName = (String)enum.nextElement();
     Object imageParamValue = request.get(parameterName);

     //is it an attached file
     if (imageParamValue instanceof FilePart) {
     FilePartArray fpa = (FilePartArray)request.get(parameterName); 

     ByteArrayInputStream bais =
                         (ByteArrayInputStream)fpa.getInputStream();
     .........

depub2 wrote:
> I am trying to use the upload feature in Cocoon. I
> understand the default upload mechanism which uploads to a
> temporary directory and requires the file to be copied or
> moved before the request ends. I can get a file to upload to
> the temporary directory.
> 
> THE QUESTION IS: How do I move/copy the file without
> dropping into some custom java code or xsp? Isn't there a
> cocoon action like "copy-file"? Do I really have to drop all
> the way down to custom java/xsp to do something simple like
> move a file?
> 
> Thanks so much!!
> 
> David


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org