1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Detect if file size is too large before uploading

Discussion in 'XenForo Suggestions' started by eberkund, Jul 27, 2014.

  1. eberkund

    eberkund Active Member

    I think it would be a great feature if the editor was able to detect if a file a user is trying to upload without having to upload it to the server. This would save a little bandwidth and make it less frustrating for users.
    graham_w, karll, BassMan and 2 others like this.
  2. Fufu

    Fufu 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.
  3. karll

    karll Well-Known Member

    eberkund likes this.
  4. eberkund

    eberkund Active Member

  5. Brogan

    Brogan XenForo Moderator Staff Member

  6. EQnoble

    EQnoble 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;
  7. eberkund

    eberkund Active 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?
    Aayush and karll like this.
  8. EQnoble

    EQnoble Well-Known Member

    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.

Share This Page