0

Created this based on doc comments: http://api.drupal.org/api/drupal/includes%21file.inc/function/file_validate_extensions/7 My upload field definition:

   $form['xml'] = array(
        #'#title' => t('Upload Document XML'),
        '#type' => 'file',
        '#description' => t('We process only XML files'),
        '#upload_location'    => "public://documents/",
        "#upload_validators"  => array("file_validate_extensions" => array("xml")),

    );

But every file type passed in...

Any suggestions, please?

Am I doing it wrong or I should call file_validate_extensions directly inside validation function

3
  • 1
    Try passing a string with a space separated list of allowed extensions.
    – AKS
    Commented Feb 14, 2013 at 16:54
  • Yep the function says the first arg to file_validate_extensions() should be "A string with a space separated list of allowed extensions.
    – Clive
    Commented Feb 14, 2013 at 16:56
  • OK, thanks, now it seems to work, but I don't see any errors. Maybe because I have 3 different forms on single page.
    – Codium
    Commented Feb 14, 2013 at 17:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.