How to create multiple image upload in a module

edited July 2014 in News & Announcements
Hi, I'm creating a Module. The relationship is A gallery has many images. That need to upload to folder and image name should update in DB.

Is there any way to do that.

Comments

  • edited 9:40AM
    You can setup a has_many relationship on your gallery model and conversely a, belongs_to relationship on your images model.
    http://docs.getfuelcms.com/general/models#relationships

    Also, in your model's form_fields method, I would use the "file" field type. In the example, below it is uploading into folder assets/images/galleries/{name} folder where {name} would be the gallery's name field in the model:
    ... form_fields($values = array(), $related = array()) { $fields = parent::form_fields($values, $related); $fields['image'] = array('type' => 'file', 'folder' => 'images/galleries/{name}'); return $fields; }
    http://docs.getfuelcms.com/general/forms#file
Sign In or Register to comment.