Unable to set file upload destination private when programmatically creating new content type with file field I am creating a module to upload video to an in house media converter - as part of the module installation I create a new content type called "user video" which has a file field as part of it.

I need to set this file field so it saves to the private files directory, however I am unable to do so. I can create the content type and add the file field - but never manage to get the upload destination to be private.

Sometimes I am able to change this via the admin interface, but sometimes this option is greyed out.

I have included the code below and would be grateful for any assistance.

//Create the file upload for the video to be converted
  $field_name = 'uploaded_video';

  //  Create the field definition array.
  $field = array(
   'field_name' =&gt; $field_name,
  'type' =&gt; 'file',
  );


  $field = field_create_field( $field );

 //  Create the field instance definition array.
  $instance = array(
      'field_name' =&gt; $field[ 'field_name' ],
      'entity_type' =&gt; 'node',
      'bundle' =&gt; 'user_video',
      'description' =&gt; 'A field for uploading video and audio content.',
      'label' =&gt; 'Video to upload',
      'settings' =&gt; array(
          'file_extensions' =&gt; 'mp4 avi wmv qti mov',
          'uri_scheme' =&gt; 'private',
          ),
      'widget' =&gt; array(
          'type' =&gt; 'file',
      ),
  );


//  Create an instance of the field and bind it to the bundle.
field_create_instance($instance)
If your issue is that the radio buttons are greyed out when trying to select the 'private' folder. 

I needed SQL access for this one;  I emptied the SQL table that relates to the field that stores the images.  In my case deleting all items was not enough and I need to manually remove all rows from the table and then put them back after the next stages.   in my case table field_data_field_upload_private files .