dongsigan2044 2016-11-17 14:43
浏览 13
已采纳

如何使图像上传成为必需

How can this section of code be made compulsory/required? The code doesn't have a simple image upload field. It is from a joomla Component. I have tried specifying the attribute "required" as with the regular html upload fields, but this has not worked.

<section class="block" id="gallery">
                <h2><?php echo JText::_('COM_BT_PROPERTY_GALLERY');?></h2>
                <div class="center">
                    <div class="form-group"> 
                     <?php
                    if ($this->params->get('fe_upload_type', 1) == 1) {
                        echo $this->loadTemplate('images_flash');
                    } else {
                        echo $this->loadTemplate('images_simple');
                    }
                    ?>
                    <?php
                        $params = new JRegistry();
                        if ($this->item->params) {
                            $params->loadArray($this->item->params);
                        }
                        $thumb_height = $params->get('thumb_height', $this->params->get("thumb_height", 180));
                        $thumb_width = $params->get('thumb_width', $this->params->get("thumb_width", 336));
                        if ($thumb_height > 100) {
                            $thumb_width = floor($thumb_width * 100 / $thumb_height);
                            $thumb_height = 100;
                        }
                        $thumbimgprocess = $this->params->get('thumbimgprocess', $this->params->get("thumbimgprocess", 1));
                        ?>
                        <ul id="sortable">
                        <?php
                            if (is_array($this->images)) {

                                foreach ($this->images as $image) {
                        ?>
                            <li title="Double-click to make default image"
                                <?php if ($image->default) echo 'class="default_image"' ?>><input class="input-default"
                                    <?php if ($image->default) echo 'checked="checked"' ?> title="Make default"
                                    name="default_image" type="radio" value="<?php echo $image->filename ?>" /> <img
                                class="img-thumb"
                                src="<?php echo JURI::root() . $path . '/' . $this->item->id . '/' . ($this->params->get('thumbimgprocess', 1) == -1 ? 'original' : 'thumb') . '-' . $image->filename; ?>" />
                                <input type="hidden" name="image_id[]" value="<?php echo $image->id ?>" /> <?php if ($image->youembed != '') {
                                                    ?>

                                <img class="img_video" src="../components/com_bt_property/assets/img/video.png" /> <?php
                                            }
                                            ?>
                                <input type="hidden" name="image_filename[]" value="<?php echo $image->filename ?>" /> <br />
                                <a href="javascript:void(0)" class="edit" onclick="editImage(this)"><?php echo JText::_('COM_BT_PROPERTY_EDIT');?></a> <a
                                href="javascript:void(0)" class="remove" onclick="removeImage(this)"><?php echo JText::_('COM_BT_PROPERTY_REMOVE');?></a>
                            </li>
                            <?php
                                }
                                ?>
                            <input type="hidden" id="property-hidden" name="video" value="<?php echo htmlspecialchars(json_encode($this->images)); ?>" />
                        <?php
                            }
                            ?>

                        </ul>
                        <a href="#" class="button" onclick="return removeAll()"><?php echo JText::_('COM_BT_PROPERTY_CLEAR_ALL');?></a>
                    </div>
                </div>
                <p style = "color:red;">
            "Note: files must not contain any form of contact details; names, phone no, email, address, company, website and so on. As designs with such content will not be approved for posting"
            </p>
            </section>
  • 写回答

1条回答 默认 最新

  • douao2000 2016-11-22 14:55
    关注

    I finally found the source code for the simple image upload button linked to the above code. All I had to do was specify required as usual, before the closing (>) file input tag.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 从Freecad中宏下载的DesignSPHysics,出现如下问题是什么原因导致的(语言-python)
  • ¥30 notepad++ 自定义代码补全提示
  • ¥15 MATLAB有限差分法解一维边值问题
  • ¥200 内网渗透测试 横向渗透 Windows漏洞 Windows权限维持
  • ¥15 数据结构图的相关代码实现
  • ¥15 python中aiohttp.client_exceptions.ContentTypeError
  • ¥30 DeepLung肺结节检测生成最大froc值对应的epoch报错
  • ¥15 信号发生器如何将频率调大,步尽值改成10
  • ¥15 keil 5 编程智能家具,风扇台灯开关,人体感应等
  • ¥100 找一名渗透方面的专家