Olivier Rossel wrote:

>>
>>
>>> Hello?
>>>
>>>             Has anyone accomplished to upload files from html forms 
>>> to the server to a specific directory ..
>>
>>
>> Yes, I did, with an action. What is the problem? 
> 
> 
> Can you please explain how you did that?
> Or may be provide us the code, if it is not copyrighted?


Well, the code is protected, so I cannot give you that. But it can be 
accomplished very simply in your action. We did things in a SAX way:

1. Get the file name that is stored in one of parameters of the your 
Request object, originally set by the HTML form on the client. It should 
point to a local file on the server into which the content of uploaded 
file is now stored. With Cocoon it will point to a location under 
<tomcat>/work. At least, in our case it does.

2. Define a Reader that reads from that file.

3. Define a Parser with a ContentHandler in the same way as you would do 
for a SAX parser, but, of course, your Parser doesn't have to be a XML 
parser. The ContentHandler could simply write everything it receives 
into a local file at your choice. In this way, one can store the 
uploaded non-XML file into a local XML file, but with the possibility to 
use filters, as in SAX.

4. Start parsing: parse(reader).


This is just one very simple possibility. If your uploaded file is 
already well-formed XML, you could use for instance Xindice to store it 
immediately into a XML database without modification.

If you don't need filtering and checking the content of your file, step 
2 to 4 can be done much simpler, but I found that solution for our 
purposes more flexible, since we dealing with non-XML input files. We 
will combine things with Xindice.

I am sure, others have better solutions.

Hopes this helps,
Andre.


> 
> 
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> 
> To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> For additional commands, e-mail: <[EMAIL PROTECTED]>
> 


-- 
Andre H. Juffer              | Phone: +358-8-553 1683
The Biocenter and            | Fax: +358-8-553-1141
     the Dep. of Biochemistry | Email: [EMAIL PROTECTED]
University of Oulu, Finland  | WWW: http://www.biochem.oulu.fi/Biocomputing/


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

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

Reply via email to