【问题标题】:Upload only images through Opencart File option通过 Opencart 文件选项仅上传图像
【发布时间】:2015-10-24 12:03:27
【问题描述】:

我正在使用 Opencart 2.0.3.1

虽然订购产品客户必须upload image。为此,我为产品添加了文件选项。但是使用文件选项,用户可以上传任何类型的文件。我想限制只上传image files(jpg,jpeg,png etc).

这里是按钮代码:(catalog/view/theme/default/template/product/product.tpl)

<?php if ($option['type'] == 'file') { ?>
            <div class="form-group<?php echo ($option['required'] ? ' required' : ''); ?>">
              <label class="control-label"><?php echo $option['name']; ?></label>
              <button type="button" id="button-upload<?php echo $option['product_option_id']; ?>" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-default btn-block"><i class="fa fa-upload"></i> <?php echo $button_upload; ?></button>
              <input type="hidden" name="option[<?php echo $option['product_option_id']; ?>]" value="" id="input-option<?php echo $option['product_option_id']; ?>" />
            </div>
            <?php } ?>

而且我没有使用外部模块。

我该怎么做?

【问题讨论】:

    标签: php image file opencart2.x


    【解决方案1】:

    您可以从管理面板设置此选项。这是下面给出的说明..

    1- open admin panel
    
    2- click on setting submenu inside system tab.
    

    3- click on server tab then you can see "Allowed File Extensions:" option. then you can set as you wish.
    

    【讨论】:

      猜你喜欢
      • 2014-12-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-25
      • 1970-01-01
      • 2012-11-24
      • 2017-03-27
      • 1970-01-01
      相关资源
      最近更新 更多