0

I'm trying to make work Multiupload Imagefield Widget in my Drupal 7 custom module with Form API... but it doesn't work :(

When I push the "Upload" button the throbber appears for a second and nothing more happens, only refreshing page. Can anybody tell me what am I doing wrong?

My module form function:

<?php

function test_module_form($form, &$form_state) {
  $form = array();
  $form['image'] = array(
    '#title' => 'Upload image',
    '#type' => 'mfw_managed_file',
    '#upload_location' => 'public://images/',
    '#upload_validators' => array(
      'file_validate_is_image' => array(),
      'file_validate_extensions' => array('png gif jpg jpeg'),
      'file_validate_size' => array(2 * 1024 * 1024),
    ),
  );

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Submit',
  );

  return $form;
}

?>

I use clean installation:

  • Drupal 7.30
  • Multiupload Filefield Widget 7.x-1.13
  • Multiupload Imagefield Widget 7.x-1.3

Widget works great out of the box in node edit form, but not in custom module. Please help. Thanks.

1 Answers1

0

Think that images folder is not writable. Are you sure there is no errors in drupal logs?

p.s. Why do you have module "Multiupload Imagefield" if you don't use it?

Lyubimov Roman
  • 1,269
  • 15
  • 27
  • Multiupload Imagefield module is needed for "mfw_managed_file" type of form field, isn't it? Yes, there are 7 notices appears in Drupal Log after pushing "Upload" button. – Alexanderos Jul 31 '14 at 12:23
  • `Notice: Undefined index: in file_ajax_upload() (line 262 of Z:\home\drupal7.loc\www\modules\file\file.module).` ----- `Notice: Undefined index: fid in file_field_widget_submit() (line 773 of Z:\home\drupal7.loc\www\modules\file\file.field.inc).` ----- `Notice: Undefined index: field in field_widget_field() (line 578 of Z:\home\drupal7.loc\www\modules\field\field.form.inc).` – Alexanderos Jul 31 '14 at 12:26
  • `Notice: Undefined index: instance in field_widget_instance() (line 603 of Z:\home\drupal7.loc\www\modules\field\field.form.inc).` *** `Notice: Undefined index: instance in field_widget_instance() (line 603 of Z:\home\drupal7.loc\www\modules\field\field.form.inc).` *** `Notice: Undefined index: in file_ajax_upload() (line 271 of Z:\home\drupal7.loc\www\modules\file\file.module).` *** `Notice: Undefined index: #suffix in file_ajax_upload() (line 280 of Z:\home\drupal7.loc\www\modules\file\file.module).` – Alexanderos Jul 31 '14 at 12:33
  • Screenshots of these notices: [1st notice](http://www.drupal.ru/files/log.png), [2nd notice](http://www.drupal.ru/files/log1.png), [3rd notice](http://www.drupal.ru/files/log2.png), [4th notice](http://www.drupal.ru/files/log3.png), [5th notice](http://www.drupal.ru/files/log4.png), [6th notice](http://www.drupal.ru/files/log5.png), [7th notice](http://www.drupal.ru/files/log6.png). – Alexanderos Jul 31 '14 at 12:35
  • P.S.: Image folder is writable 100%. – Alexanderos Jul 31 '14 at 12:38