Hi Tyler,

your form isn't using the correct encoding type, it should be:
<form name="category_data" action="${v SUBMISSION:FORM:category_data/}" method="post" enctype="multipart/ form-data">

Without this, the file uploads aren't sent by the browser.

Best regards,

Geert


On 30 Jun 2006, at 05:33, Tyler Pitchford wrote:

I cannot seem to get the image data to save to the CMF. The name field
of the bean is successfully inserted into the DB, but the image data
is definitely not being saved within the CMF. I've included all the
important information below.

public class CategoryMetaData extends MetaData {
        public void activateMetaData() {
                addConstraint(new 
ConstrainedProperty("id").identifier(true).unique(
                                true));
addConstraint(new ConstrainedProperty("name").notNull (true).maxLength(
                                128));
                addConstraint(new ConstrainedProperty("image").mimeType(
                                MimeType.IMAGE_JPEG).file(true));
        }
}

---

public Category {
        private int id = -1;
        private String name = null;
        private byte[] image = null;

       ...
}

---

<r:i name="common.blueprint"/>
<r:bv name="content">
        <form name="category_data" action="<r:v
name="SUBMISSION:FORM:category_data"/>" method="post">
                <r:v name="SUBMISSION:PARAMS:category_data"/>
                <input type="input" name="name"/>
                <input type="file" name="image"/>
                <input type="submit"/>
        <form>
</r:bv>

---

        public void processElement() {
                Template template = getHtmlTemplate("testers.test");
                Category category = (Category)
getNamedSubmissionBean("category_data", "category");
                
                if(category != null){
                        CategoryManager manager = new
CategoryManager(DatabaseHelper.getDatasource());
                        manager.save(category);
                }
                print(template);
        }

CategoryManager's save uses a ContentQueryManager set to Category.class.

---
Inside the Element:

                <submission name="category_data">
<bean name="category" classname="com.warfrog.portal.beans.Category"/>
                </submission>

---

Cheers,
 Tyler
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users


--
Geert Bevin
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com


_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to