I am trying to add items to a form (in code) similar to the add image item in the Drupal Add Content form that has the Browse and Upload buttons. In Firefox, the Browse button invokes a Pop-up window to search files on the user's computer and returns the selected file & path to the associated text box. I would like to review the code in Drupal to understand and duplicate the action. Thus far I cannot locate the code in core modules (its big in there and a file search does not find the word "Browse"!). Does anyone know where the add content form is, or a reference site that explains it, or how to code it?
|
I recently created a few custom blocks with image upload and preview fields. Here's the relevant code that should be helpful for you:
|
|||
|
|
|
The functionality you're referring to is built into Firefox (and all other browsers) so you won't be able to find the code in the Drupal code base. It occurs whenever you use In order to get that functionality in your forms use the |
|||
|
|
|
If you are running Drupal 6, you need the Imagefield module (http://drupal.org/project/imagefield) but if running Drupal 7, it's already part of the core Content Construction Kit (CCK). To use it in either case, just create a content type with an image field and when you then create that content, it will bring up what you're used to seeing, eg, that browser form, when you input that field. |
|||
|