Detect if file size is too large before uploading


Well-known member
xenForo does not already check the file? Nice suggestion. I have not tried to upload a oversized file myself. I will have to try this.

I almost want to add another suggestion to this thread, but may an add-on would help cause it probably be server intensive what I would propose.


Well-known member
The only thing I know of for ie that you can do to check filesize before a transfer is using filesystem object which needs activex which most people leave disabled...

var fso, f1;
fso = new ActiveXObject("Scripting.FileSystemObject");
f1 = fso.GetFile("c:\\test.txt");
The following is a snippet I had in a directory full of snippets, if I can find the source of the snippet I will update it (though relying on activex is kinda dookie so it is probably pointless to mention)...

 if ($.browser.msie) {
var fso = new ActiveXObject("Scripting.FileSystemObject");
var fPath = $("#" + fileid)[0].value;
var objFile = fso.getFile(fPath);
var fSize = objFile.size;
fileSize = fSize / 1048576;


Well-known member
IE is often problematic, can't it just be done so that it works for everyone using a proper browser but reverts to the current behavior for people using IE?
I think if anything is to be done to it at all that this is the best way to go about it. Generally my upstream is fast enough where it doesn't matter to me personally but for those with slower connections and for people with weak servers this has the capability to reduce waste on both server and client sides I suppose.