لا يوجد أي حظ في العثور على هذا في Drupal أو أمثلة المطورين. أحتاج إلى تعيين حقل نموذج يُدار file_file للسماح فقط للملفات المضغوطة في Drupal 7 وحدة مخصصة .
$form['picture']['file'] = array(
'#type' => 'managed_file',
'#title' => t('picture'),
'#description' => t('Allowed extensions: gif png jpg jpeg'),
'#default_value' => (isset($foo->picture->fid) ? $foo->picture->fid : ''),
'#upload_location' => variable_get('picture_upload_location'),
'#upload_validators' => array(
'file_validate_extensions' => array('gif png jpg jpeg'),
// Pass the maximum file size in bytes
'file_validate_size' => array(MAX_FILE_SIZE*1024*1024),
),
);
لست متأكدًا مما إذا كنت تستخدم Drupal 6 أو Drupal 7 ، ولكن في Drupal 6 ستختار:
Admin> Content> أنواع المحتوى> [Your Content Type]> Manage Fields> [Edit your file field] وابحث عن إعداد الحقل "ملحقات تحميل الملفات المسموح بها"
في هذا الحقل ، أدخل الرمز البريدي
دروبال 7 على الأرجح مشابه. ابحث عن أنواع المحتوى ضمن Admin> Structure.