2016-11-17 103 views
0

這部分代碼如何被強制/要求?該代碼沒有簡單的圖片上傳字段。它來自joomla組件。我試過用常規的html上傳字段來指定屬性「required」,但是這並沒有奏效。如何製作圖片上傳

<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> 

回答

0

我終於找到了鏈接到上面代碼的簡單圖像上傳按鈕的源代碼。我只需要像平常一樣在結束(>)文件輸入標籤之前指定所需的。