[development] create nodes with attached files using drupal_execute

David Cohen drupal at dave-cohen.com
Wed Nov 14 23:37:31 UTC 2007


Consider using the Upload API module, http://drupal.org/project/upapi.

It provides a form element type for a file upload, making it relatively
easy to add file fields to nodes and other Drupal forms.  It is not
exposed via CCK, but hopefully will be in the future.  For now, you have
to use hook_form or hook_form_alter.

It also has some support for previews.  That is, hit the preview button
on the node form and you'll see files that haven't yet been submitted. 
As far as I know neither the upload module or the CCK fields support
this.

-Dave


On Wed, 14 Nov 2007 17:18:44 -0500, "Isaac Simon Hodes"
<ISimonHodes at jwa.org> said:
> Hello, I'm new to the forms API and hoping for some advice. I am
> creating a multistep form in 5.3. The form uses drupal_execute to
> generate new CCK nodes. The basic form is working, but I cannot figure
> out how to make drupal_execute attach files to the new nodes as it
> creates them.
> 
>  
> 
> I would like to simply pass a form value to the CCK node form (through
> drupal_execute) along with the other necessary fields. E.g. something
> along the lines of
> 
> 
> 
> $values['file']['field_object_file_upload'][0] =
> $form_values['my_form_file_upload_field'];
> 
>  
> 
> Solutions involving either upload module or a CCK file field would be
> fine.
> 
>  
> 
> Does anyone have advice?  (I hope this is an appropriate question for
> the "development" list. Based on the descriptions at lists.drupal.org
> that seems to be the case; if not, please let me know where I should
> post it.) Thanks for your help!
> 


More information about the development mailing list