Hi all!
I'm quite new at drupal module development and I gues I still have a lot to learn. I'm trying to implement something for 2 days without any success and I hope you guys can help me out. I followed different guides such as http://www.akchauhan.com/create-image-upload-field-using-drupal-form-api/ and I still could no make it work.
I want to make a form in the settings of my module with a text field and an image upload field. I got the textfield to work but I'm having trouble with the image uploader.
In my file panorama.admin.inc I got the following function to define the form.
function panorama_admin_settings() {
//panorama titel
$form['panorama_title'] = array(
'#title' => t('Panorama Titel'),
'#type' => 'textfield',
'#required' => TRUE,
'#description' => t('Vul de titel in van de panorama foto'),
'#default_value' => variable_get('panorama_title', 'ONTDEK ONZE WINKEL'));
//panorama foto
$form['panorama_picture'] = array(
'#type'=> 'fieldset',
'#title' => t('Panorama foto'));
$form['panorama_picture']['picture_upload'] = array(
'#type' => 'file',
'#title' => t('Upload panorama foto'),
'#size' => 150,
'#description' => 'Maximum grootte is 1,5MB en de maximum dimensies zijn 3000x400');
$form['#validate'][] = 'panorama_validate_picture';
$form['#attributes']['enctype'] = 'multipart/form-data';