如何在HTML表單中允許多個檔案上傳
In this article, we will learn how to allow multiple files uploads in HTML forms.
我們使用多個屬性,以允許在HTML表單中進行多個檔案上傳。多個屬性適用於電子郵件和文件輸入類型。
If you want to allow a user to upload the file to your website, you need to use a file upload box, also known as a file, select box. This is created using the element and the type of attribute is set to file.
文法
以下是在HTML表單中選擇多個檔案上傳的語法。
<input type="file" name="name" multiple>
範例(使用多個屬性)
以下是HTML表單中選擇多個檔案上傳的範例程式。
<!DOCTYPE html> <html> <head> <title>Upload multiple files</title> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <form> <input type="file" name="name" multiple><br><br> <br> <input type="submit" value="Submit"> </form> </body> </html>
以下是上述範例程式的輸出,其中在輸入欄位中未選擇任何檔案。
We have chosen only one file in the input field. Below is the output shows the file, we have chosen.
我們也可以選擇盡可能多的檔案。下面的輸出顯示我們選擇的文件數量。
Using ‘multiple’ Attribute with Values of Multiple Files
The below syntax work same as the above-mentioned syntax. We assign ‘multiple’ attribute with the value of multiple for selecting multiple files in the input field.
文法
以下是在HTML表單中選擇多個檔案上傳的語法。
<input type="file" name="name" multiple=>
Example
的中文翻譯為:範例
以下是在HTML表單中選擇多個檔案上傳的範例程式。
<!DOCTYPE html> <html> <head> <title>Upload multiple files</title> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <form> <input type="file" name="name" multiple="multiple"><br><br> <br> <input type="submit" value="Submit"> </form> </body> </html>
正如我們在輸出中看到的,我們已經選擇了四個檔案進行上傳。
以上是如何在HTML表單中允許多個檔案上傳的詳細內容。更多資訊請關注PHP中文網其他相關文章!

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

熱門話題

本文討論了HTML&lt; Progress&gt;元素,其目的,樣式和與&lt; meter&gt;元素。主要重點是使用&lt; progress&gt;為了完成任務和LT;儀表&gt;對於stati

本文討論了html&lt; datalist&gt;元素,通過提供自動完整建議,改善用戶體驗並減少錯誤來增強表格。Character計數:159

本文討論了HTML&lt; meter&gt;元素,用於在一個範圍內顯示標量或分數值及其在Web開發中的常見應用。它區分了&lt; meter&gt;從&lt; progress&gt;和前

本文討論了視口元標籤,這對於移動設備上的響應式Web設計至關重要。它解釋瞭如何正確使用確保最佳的內容縮放和用戶交互,而濫用可能會導致設計和可訪問性問題。

HTML適合初學者學習,因為它簡單易學且能快速看到成果。 1)HTML的學習曲線平緩,易於上手。 2)只需掌握基本標籤即可開始創建網頁。 3)靈活性高,可與CSS和JavaScript結合使用。 4)豐富的學習資源和現代工具支持學習過程。

本文討論了&lt; iframe&gt;將外部內容嵌入網頁,其常見用途,安全風險以及諸如對象標籤和API等替代方案的目的。

HTML定義網頁結構,CSS負責樣式和佈局,JavaScript賦予動態交互。三者在網頁開發中各司其職,共同構建豐富多彩的網站。

AnexampleOfAstartingTaginHtmlis,beginSaparagraph.startingTagSareEssentialInhtmlastheyInitiateEllements,defiteTheeTheErtypes,andarecrucialforsstructuringwebpages wepages webpages andConstructingthedom。
