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' => $field_name, 'type' => 'file', ); $field = field_create_field( $field ); // Create the field instance definition array. $instance = array( 'field_name' => $field[ 'field_name' ], 'entity_type' => 'node', 'bundle' => 'user_video', 'description' => 'A field for uploading video and audio content.', 'label' => 'Video to upload', 'settings' => array( 'file_extensions' => 'mp4 avi wmv qti mov', 'uri_scheme' => 'private', ), 'widget' => array( 'type' => 'file', ), ); // Create an instance of the field and bind it to the bundle. field_create_instance($instance)