How to programmatically set a file field to allow multiple uploads/values? I have created a file field with field_create_field() and added an instance of it to my custom node type with field_create_instance() in my module's hook_install()function. But how do I set it to allow unlimited file uploads. I can do it in the drupal interface by going to structure &gt; content types &gt; manage fields and clicking edit for my file field. I can set number of values on that page but how do I do it programmatically? There must some settings key I suppose but could not find it online.

I am using drupal 7.
my example, see "cardinality" value:

$field = array(
  'field_name' =&gt; 'field_ws_file', 
  'type' =&gt; 'file',
  'cardinality' =&gt; FIELD_CARDINALITY_UNLIMITED,
);
field_create_field($field);


Instead of FIELD_CARDINALITY_UNLIMITED you could also simply use -1.