Upload a file using a plugin

Hi,

For one of my plugins I would like to give the possibility to upload images that will serve as a logo. I do not want to use AdminImage to avoid using two plugins for a single feature. I would like the uploading of images to work in the same way as adding logo to Omeka themes (like Thanks Roy or Seasons). So I load a form with a file element like this :

$this->addElement(‘file’, ‘footer_img’,
array(‘id’ => ‘footer_img’,
‘description’ => __(‘Choose an image to add to the footer.’),
‘label’ => __(‘Footer image’),
)
);

Is this a good way to do it ?

So I do not know what to do in the controller to upload the image and save it in the database. Could you guide me on how to proceed ?

Thank you for your help.

Since this seems very much theme-centric, it might be easier and quicker to modify one of the existing themes to add the footer image upload in the appearance settings, following the pattern you’ve seen in Thanks Roy and Seasons.

You are quite right !

But what I did not specify is that I would add an unknown number of images for the footer. However, you can’t dynamically add elements to the theme configuration page.

To summarize what I want to do, I would like to add a file element in the form and when it was filled with an image, another field appears underneath to add more…

My idea is maybe bad or unrealizable, I don’t know, but would you know how to do or would you have other ideas ?