[英]How to add image field in form drupal 7
我正在創建一個如圖所示的表單,通過將php代碼放在body塊中在后台將詳細信息保存在csv中,效果很好,但是誰能告訴我如何在表單中添加圖像上傳選項並將其保存在其他地方
首先不要在主體塊中添加代碼。 創建一個自定義模塊。
要添加圖像字段,請參閱Drupal Form API 。
例如。
$form['image_example_image_fid'] = array(
'#title' => t('Image'),
'#type' => 'managed_file',
'#description' => t('The uploaded image will be displayed on this page using the image style choosen below.'),
'#default_value' => variable_get('image_example_image_fid', ''),
'#upload_location' => 'public://image_example_images/',
);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.