翻譯不完整。請協助 翻譯此英文文件

File()  建構子建立一個新的 File 物件實例

語法

var myFile = new File(bits, name[, options]);

參數

bits
An Array of ArrayBuffer, ArrayBufferView, Blob, or DOMString objects — or a mix of any such objects. This is the file content encoded as UTF-8.
name
檔案名稱或檔案的路徑(USVString)。
options 選擇性
物件選項,包含物件非必要的屬性,以下為可得到的屬性:
  • type: 物件的 MIME 類型(DOMString )將被放進檔案中,預設為 ""(空值)。
  • lastModified: 檔案最後修改時間,格式為毫秒,預設為 Date.now().

範例

var file = new File(["foo"], "foo.txt", {
  type: "text/plain",
});

規格

規格 狀態 說明
File API Working Draft 初始化定義

瀏覽器相容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 13 No support 7 (7) No support 11.5 10.1
 
Feature Android Edge Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support 4.4.4 (Yes) 7.0 (7) No support No support 6.0

看更多

文件標籤與貢獻者

此頁面的貢獻者: lynn456
最近更新: lynn456,