0

This question extends a previous one. The previous answer stated that the pop-up window to search the user's computer for a file to upload is called using . I am not certain how to make the call from within the form_submit function and have searched the core code for an example without success. I know that add content has a widget to add an image file, but I cannot find the code generating it. I even did a file search for the word "Browse" which is the title of the button without finding a single file.

Does anyone have an example of how I would direct a call to a browser function from within the Drupal form? OR Does anyone know where the add content form widget for adding a file is at?

2 Answers 2

1

To output a file select form element in a Drupal form, you simply add a file or managed file element.

$form['upload'] = array(
    '#type' => 'file',
    '#title' => t('Choose a file')
  );
)
0

again, you are confusing client and server. the code that generates the popup is within the browser (client). it is not within drupal (server). all drupal does is "send" an html request that is interpreted within the browser which then presents the content to the user. the browser creates whatever is needed, whether it be this is bold text by sending a "less than" b "greater than" this is bold text "less than" "slash" b "greater than" or something more complicated like a form element asking for a file.

1
  • I understand that. I have been looking for an example of Drupal code making the request. I had found an example of a form that makes such a request but could not locate the code.
    – Ashlar
    Commented Dec 1, 2011 at 23:43

Your Answer

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

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