簡體   English   中英

為什么html的輸入標簽中的多個屬性不起作用?

[英]Why multiple attribute in input tag of html is not working?

我似乎無法在我的輸入中使用多個標簽。 我正在嘗試拍攝多張照片,稍后將這些照片納入健康和安全表格。 目前我能做的就是拍一張照片。

我是如何錯誤地使用它的。 我知道它可以與 type="file" 一起使用。 我希望這是一個簡單的語法錯誤

<!DOCTYPE html>
<html>
<body>

<h2>The multiple Attributes</h2>
<p>The multiple attribute specifies that the user is allowed to enter more than one value in the input element.</p>

<form action="/action_page.php">
  Take photos: <input type="file" accept="image/*" capture="camera" multiple><br>
  <input type="submit">
</form>

<p>I wonder how I can take more than one photo.</p>

<p><strong>Note:</strong> The multiple attribute of the input tag is not supported in Internet Explorer 9 and earlier versions.</p>

</body>
</html>

您的表單應具有“enctype”屬性。 並且您的文件輸入應該有一個屬性為“multiple”,這將為您工作。

例子:

    <form action="" enctype="multipart/form-data" method="post">
   <div><label for='upload'>Add Attachments:</label>
   <input id='upload' name="upload[]" type="file" multiple="multiple" />
   </div></form>

但我建議你使用像uploadify這樣的多文件上傳

需要像這樣

   <form action="/action_page.php"  method="POST" enctype="multipart/form-data">

 Take photos: <input type="file" name="files[]" type="file" multiple="multiple" accept="image/*" capture="camera" multiple><br>
 <input type="submit">
</form>

方法="POST" enctype="multipart/form-data"

您錯過了不會上傳文件和方法的 enctype 應該發布

enctype(ENCode TYPE) 屬性指定表單數據在提交到服務器時應如何編碼。 multipart/form-data 是 enctype 屬性的值之一,用於有文件上傳的表單元素。 多部分是指表單數據分成多個部分並發送到服務器。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM