Hi,

I've done like this, and its working .I've used Cocoon 2.1.10 CForms 

Cforms Binding File:
<fb:value id="uploadFieldName" path="documentPart" direction="save"/>

Repeater:

<fb:on-insert-row>
                        <fb:insert-bean classname="BeanClassName" 
addmethod="addNewAttachment"/>
//specify the beanClassName in the classname ATTRIBUTE
                </fb:on-insert-row>

Backend Logic:

public class Sample {
private org.apache.cocoon.servlet.multipart.Part documentPart; //add
gettters & setters for this field

..
..
}

Binding bean:

public void addNewAttachment(Sample sample){
                if(sample.getDocumentPart()!=null){
                        
sample.setFileName(sample.getDocumentPart().getFileName());
                        try {
                                InputStream inputStream  = 
sample.getDocumentPart().getInputStream();
                                byte[] theBytes = new 
byte[inputStream.available()];
                                inputStream.read(theBytes);
                                sample.setDocument(theBytes); //specfiy the 
database field which you are
going to set
//perform the logic for adding the record to database

                        } catch (IOException e) {
                                e.printStackTrace();
                        }
                }
        }


Regards,
Mohammed
-- 
View this message in context: 
http://www.nabble.com/MultiPart-upload-action-tp20034622p20044401.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


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

Reply via email to