< HTML > < HEAD > < SCRIPT > ... function getFileSize (fileName) ...{ if (document.all) ...{ window.oldOnError = window.onerror; window.onerror = function (err) ...{ if (err.indexOf('utomation') != -1) ...{ alert('file access not possible'); return true; } else return false; }; var fso = new ActiveXObject('Scripting.FileSystemObject'); var file = fso.GetFile(fileName); window.onerror = window.oldOnError; return file.Size; } } </ SCRIPT > </ HEAD > < BODY > < FORM NAME ="formName" > < INPUT TYPE ="file" NAME ="fileName" > < BR > < INPUT TYPE ="button" VALUE ="check file size" ONCLICK ="alert(getFileSize(this.form.fileName.value))" > </ FORM > </ BODY > </ HTML > ie可以 firefox不可以 这两天在搞这个上传的问题 过两天整理好了后 再做个总结!