You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Stephan Coboos <cr...@gmx.net> on 2003/12/23 10:04:40 UTC

autosave-uploads doesn't work?

Hello,

I need to upload a file. Therefore I have read the documentations on the 
wiki. Uploading files looks thery simple, but doesn't work on my system. 
I want to auto upload the file into the folder 
$CATALINA_HOME/cocoon/media/images, so I have changed the following 
entries in the web.xml:

    <init-param>
      <param-name>upload-directory</param-name>
      <param-value>media/images</param-value>
    </init-param>

    <init-param>
      <param-name>autosave-uploads</param-name>
      <param-value>true</param-value>
    </init-param>

My form looks like the following:

   <form action="upload" method="POST" enctype="multipart/form-data">
      <input type="file" name="picture"/>
      <input type="submit" value="Upload now"/>
   </form>

After pressing "Upload now" the file should be placed into media/images, 
I'm right? But nothing is placed on this directory. Why?

I'am using a flowscript to validate some input datas and I don't want to 
"write out" the InputStream, but this works fine. I'am receiving the 
Part-Object an then I'am able to "write down" the stream to disk but I 
dont want this. But why autosave-uploads doesn't work?

Thank you!


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


Re: autosave-uploads doesn't work?

Posted by Geoff Howard <co...@leverageweb.com>.
Stephan Coboos wrote:
> Hello,
> 
> I need to upload a file. Therefore I have read the documentations on the 
> wiki. Uploading files looks thery simple, but doesn't work on my system. 
> I want to auto upload the file into the folder 
> $CATALINA_HOME/cocoon/media/images, so I have changed the following 
> entries in the web.xml:
> 
>    <init-param>
>      <param-name>upload-directory</param-name>
>      <param-value>media/images</param-value>
>    </init-param>
> 
>    <init-param>
>      <param-name>autosave-uploads</param-name>
>      <param-value>true</param-value>
>    </init-param>
> 
> My form looks like the following:
> 
>   <form action="upload" method="POST" enctype="multipart/form-data">
>      <input type="file" name="picture"/>
>      <input type="submit" value="Upload now"/>
>   </form>
> 
> After pressing "Upload now" the file should be placed into media/images, 
> I'm right? But nothing is placed on this directory. Why?
> 
> I'am using a flowscript to validate some input datas and I don't want to 
> "write out" the InputStream, but this works fine. I'am receiving the 
> Part-Object an then I'am able to "write down" the stream to disk but I 
> dont want this. But why autosave-uploads doesn't work?

A philosophy change was introduced in 2.1 which never leaves uploaded 
files on disk automatically - they must be acted on by flowscript, 
action, etc.  This was introduced as a security mechanism since there is 
not a way to control upload permissions beyond on/off.  Any multipart 
form field sent to _any_ page in Cocoon would have its contents 
automatically saved under the old system (if uploads were enabled).

So, things are working as designed if you can get the "Part" and save it 
in a flow script, but it is gone at the end of the request.  What 
documentation did you read specifically?  The above information should 
be made clear there if not already.

Unfortunately, the config param name "autosave-uploads" is now 
inappropriately named (and the web.xml comment is supposed to reflect 
this) but has been kept for backwards compatibility.  As I am swamped, 
would you mind pointing out some specific places in the docs, wiki, etc. 
which  you find misleading?

Geoff


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