If I don't specify directory I can upload file.
However if I try do it I am getting error:
The upload directory public://osw_majatkowe_m for the file field field_osw_majatkowe_m_file could not be created or is not accessible. A newly uploaded file could not be saved in this directory as a consequence, and the upload was canceled.
osw_majatkowe_m is my content type stored in $type variable.
$instance = array( 'field_name' => $ct_info['file_field_name'], 'entity_type' => 'node', 'label' => 'Plik', 'bundle' => $type, 'required' => false, 'settings' => array( 'file_extensions' => '', 'file_directory' => $type, 'uri' => 'public://'.$type, ), 'widget' => array( 'type' => 'file_generic', ), ); field_create_instance($instance);
I want to have files for content type is seperate directory in sites/default/files.