0

If a content type has an image field then when the user creates new content, he is present with an image section on the form with a widget to "Browse" for a file. Clicking it provides a pop-up window standard dialog box for selecting a file. I would like to examine how this works to use it in a custom module, but cannot locate the code in the core modules.

3 Answers 3

1

The dialog box is a feature of your browser. The server sends HTML code looking something like

<input type="file">

Most browsers render this by providing a text input field and a Browse button.

1
  • I have searched through core trying to find an instance of this call in association with the Browse button mentioned in my question to confirm how to incorporate it into a form without success. I have asked a new question seeking an answer. Can you help?
    – Ashlar
    Commented Dec 1, 2011 at 15:53
2

The code to generate a field upload form element is in theme_file(). The code is very simple because all it does is to output an HTML file select form element. As explained in other answers, the files browsing dialog is provided by the web browser and, most of the time, re-uses the operating system native one.

0

You are confusing client side and server side. The code you are seeking is internal to the browser (the client); it is not within Drupal (the server).

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.