输入类型文件,仅通过单击按钮触发弹出窗口

input type file, trigger the popup by a button click only

我有这个文件上传控件:

其中有这个标记:

<div class="controls">
    <input name="attachments[]"  id="attachment_control" runat="server" type="file" /><br />     
    <div id="fileuploads" runat="server"></div>
</div>

我想以某种方式修复此控件,使弹出窗口仅在单击 浏览 按钮时显示。就像现在一样,在您单击控件的任何地方,都会显示上传弹出窗口,但我只想在用户单击按钮时显示弹出窗口。

我该怎么做?

$("#nofile").click(function() {
      $("#fileuploads").click();
      });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="controls">
     <label>File</lable>
     <input type="button" value="Upload" id="nofile"  width="30px"/>
     <input type="file" id="fileuploads" runat="server" style="display: none;" />
     </div>

这可能有帮助

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>

<div class="controls">
 <label>File</lable>
 <input type="button" value="Upload" id="nofile"  width="30px"/>
 <input type="file" id="fileuploads" runat="server" style="display: none;" />
 </div>

  <script type="text/javascript">
  $("#nofile").click(function() {
  $("#fileuploads").click();
  });
  </script>