Re: more fields for David Persson's media plugin form?
Hello Tan Cheng, Just add a new input to your form: echo $form-input('file', array('type' = 'file', 'label' = false, 'class' = 'imageUpload')); echo $form-input('title'); Be sure $this-data looks somewhat like this in your controller action: array( 'Gallery' = array( 'file' = '...', 'title' = 'My Title' ) ); Than just save the record as you normally do. Make sure there's a 'title' column in the table schema. That's basically it. In case you're using a separate table i.e. 'images' to store the file data instead of storing it in the 'galleries' table follow these instructions: * Gallery and Image models must be associated with each other hasMany/hasOne/... * Your form must produce a data array which reflects this structure (see [1]). * Use saveAll in your controller action. [1] http://book.cakephp.org/view/1032/Saving-Related-Model-Data-hasOne-hasMany-belongsTo - David -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
more fields for David Persson's media plugin form?
Hi everyone, I am now using David Persson's media plugin to handle the ajax upload now. But the upload form only shows the file type input, like ?php echo $form-create('Gallery', array('type' = 'file')); echo $form-input('file', array('type' = 'file', 'label' = false, 'class' = 'imageUpload')); echo $form-end(); ? What if I want to add more fields, like the title of the photo or some description to add to my image table in db? I have added $form- input('title'), but it doesn't show up at all. Anyone had experience using this plugin? How to customise this? Thank you very much!! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php