How to add an image upload field to a node programmatically? I want to add an image upload field to a node programmatically when the node is being loaded.

I heard that you could use hook_form_alter() but I am looking for better options. Could anyone provide a solution?
Add a CCK imagefield to the node.

If you need to show / hide it, use your form_alter to set ['#access'] = FALSE on the field.