Automatically closed - issue fixed for 2 weeks with no activity.
I create a custom module refered to "content_entity_example" module of to upload file.
is it possible to use BaseFieldDefinition here ?
This is my code
$validators = array(
'file_validate_extensions' => array('pdf doc docx xls xlsx ppt pptx png jpg jpeg'),
'file_validate_size' => array(file_upload_max_size()),
);
$fields['fid'] = BaseFieldDefinition::create('file')
->setLabel(t('File Name'))
->setDescription(t('The File of the associated event.'))
//->setSetting('target_type', 'file')
//->setSetting('handler', 'default')
->setSetting('upload_validators', $validators)
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'file',
'weight' => -3,
))
->setDisplayOptions('form', array(
'type' => 'file',
'description' => array( // doesn't work
'theme' => 'file_upload_help', // doesn't work
'description' => t('A Gettext Portable Object file.'), // doesn't work
), // doesn't work
'settings' => array(
'upload_validators' => $validators,
),
'weight' => -3,
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
My problem is
1. using pdf doc docx xls xlsx ppt pptx png jpg jpeg file
- in description help informed Available extension is only txt
- i can upload file using extension above
- when submit button clicked i got error message that allowed extention is only txt.
2. using txt file
- i can not upload file and got an error that available extension are "pdf doc docx xls xlsx ppt pptx png jpg jpeg".
How to fix it ?
Thanks
Fixed
1.0
Content Entity Example
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Automatically closed - issue fixed for 2 weeks with no activity.