I'm looking for a way to upload many files by means of the managed_file form API element. I would like it be like while uploading for node where is 'add new item' button. How to do it?

  • What is managed_file field. Is it a field you created. – 15dk51 Jul 11 '13 at 7:06
  • It's #type from Drupal Form API. I want to do it by code. – deem Jul 11 '13 at 7:08
  • If it's about Form API, it's not a "field", it's a "form element" - these terms have very specific meaning. So, if I read you right, you should remove tag fields and add form-api. And of course edit content to replace word "field". – Mołot Jul 11 '13 at 7:11

You may want to use plupload form element instead. Install Plupload integration module and then use something like:

$form['my_element'] = array(
  '#type' => 'plupload',
  '#title' => t('Upload files'),
  '#description' => t('This multi-upload widget uses Plupload library.'),
  '#upload_validators' => array(
    'file_validate_extensions' => array('jpg jpeg gif png txt doc xls pdf ppt pps odt  ods odp'),
    'my_custom_file_validator' => array('some validation criteria'),
  '#plupload_settings' => array(
    'runtimes' => 'html5',
    'chunk_size' => '1mb',
| improve this answer | |
  • I installed it and there is only info like "This multi-upload widget uses Plupload library. Allowed file types: jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp." – deem Jul 11 '13 at 9:24
  • Check with Firebug, probably there is some javascript error. – Mołot Jul 11 '13 at 9:29
  • Paths issue, however I would like to use the managed_file type. – deem Jul 11 '13 at 11:09
  • @daroPL Sadly, there is no "managed_files" type, just "managed_file". – Mołot Jul 11 '13 at 11:11
  • I had a look on file_field_widget_form() and there it is done it by manage_file. – deem Jul 11 '13 at 11:29

I used below Solution. Its worked for me. Click Here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.