duanbenzan4050 2014-01-19 08:10
浏览 11
已采纳

如何在形式drupal 7中添加图像字段

i am creating a form as shown in image which saves detail in csv in background by putting php code in body block which works fine but can anyone tell me how to add the image upload option in form and to save the same in other place

enter image description here

  • 写回答

1条回答 默认 最新

  • duanpie4763 2014-01-19 18:00
    关注

    First do not add code in body block. Create a custom module.

    To add image field please refer Drupal Form API.

    Eg.

    $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/',
    );
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?