--- title: File.name slug: Web/API/File/name tags: - DOM - Files translation_of: Web/API/File/name ---
{{APIRef("File API")}}
Gibt den Namen der File zurück. Aus Sicherheitsgründen wird der Pfad der Datei nicht mit zurückgegeben.
var name = instanceOfFile.name
Ein string, der den Namen der File ohne Pfad beinhaltet, bspw. "My Resume.rtf".
// fileInput is a HTMLInputElement: 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); }
Specification | Status | Comment |
---|---|---|
{{SpecName('File API', '#file-attrs', 'name')}} | {{Spec2('File API')}} | Initial definition. |
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
File.name | 13.0 | {{CompatGeckoDesktop("1.9.2")}} | 10.0 | 16.0 | {{CompatNo}} |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
File.name | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} |