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.


  • edited 7:12PM
    You can setup a has_many relationship on your gallery model and conversely a, belongs_to relationship on your images model.

    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; }
Sign In or Register to comment.