How to upload images in an addon?


I’m trying to add an additional field to content pages to upload an image. I know you can insert images into the RTE, but because of design issues we need to have more control.

I tried to use the “common/attach_images.tpl” template, but I’m kinda lost on what I have to do in the controller afterwards to save the images and add them to the images Database.

Any help you guys can give me would be much appreciated



ok first verify that. In your update form must have correctly enctype=“multipart/form-data” because from install it was not declare.

after that you could add on function fn_get_page_data this

if (!empty($pages)) {

$pages['main_pair'] = fn_get_image_pairs($fans['page_id'], 'pages', 'M',true, false, $lang_code);


and on fn_get_pages : a least declare

foreach ($pages as $k => $v) {

$pages[$k]['main_pair'] = fn_get_image_pairs($v['page_id'], 'pages', 'M', true, false, $lang_code);


before doing this you have to adapt var names may be.

Hoope it could help you

best regards