We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

Blob.size 屬性回傳以 byte 為單位的 Blob 或一個 File 的大小。


var sizeInBytes = blob.size



// fileInput 是個 HTMLInputElement: <input type="file" multiple id="myfileinput">
var fileInput = document.getElementById("myfileinput");

// files 是個 FileList 物件 (類似 NodeList)
var files = fileInput.files;

for (var i = 0; i < files.length; i++) {
  console.log(files[i].name + " has a size of " + files[i].size + " Bytes");


規格 狀態 附註
File API
The definition of 'size' in that specification.
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!

功能 Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
File.size 5 (Yes) 4.0 (2) 10.0 11.10 5.1
功能 Android Edge Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
File.size No support (Yes) No support No support No support No support



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