From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/api/file/name/index.html | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 files/zh-cn/web/api/file/name/index.html (limited to 'files/zh-cn/web/api/file/name') diff --git a/files/zh-cn/web/api/file/name/index.html b/files/zh-cn/web/api/file/name/index.html new file mode 100644 index 0000000000..a43ef5913b --- /dev/null +++ b/files/zh-cn/web/api/file/name/index.html @@ -0,0 +1,22 @@ +--- +title: File.name +slug: Web/API/File/name +translation_of: Web/API/File/name +--- +

{{APIRef("File API")}}

+ +

概述

+ +

返回文件的名称.由于安全原因,返回的值并不包含文件路径.

+ +

示例

+ +
// fileInput is a HTMLInputElement: <input type="file" multiple id="myfileinput">
+var fileInput = document.getElementById("myfileinput");
+
+// files is a FileList object (simliar to NodeList)
+var files = fileInput.files;
+
+for (var i = 0; i < files.length; i++) {
+  alert("Filename " + files[i].name);
+}
-- cgit v1.2.3-54-g00ecf