I'm using a custom form for editing content in a project and want to build in an cck image upload. So far I'm using the following code:
$element = content_fields('field_image', MY_NODE_TYPE);
$form['#field_info']['field_image'] = $element;
$element = (array) content_field_form($form, $form_state, $element);
$form['field_image'] = $element['field_image'];
This displays 2 upload-fields + 1 "add more" button.(all ajaxified) When I'm trying to upload an image via the first 2 fields the preview of the image isn't shown afterwards.
When I use the "add more" to add a new field the first 2 fields start to work again.
So my question is: What exaclty is neccessary to get the two fields to work initially? Might be some AHAH/Ajax behviours?!