pkm*_*pkm 2 php image 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/',
);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4745 次 |
| 最近记录: |