Check Document Size Before Upload

Format a TIMESTAMP Attribute
July 23, 2017
Conditional Icons and Colour in Custom Query
July 23, 2017

Some have reported issues when a user tries to upload an unusually large file. Issues such as taking the server down. 

This small snippet of script check the file size when the file is selected and ensures that the file is less than 5mb

Credit to RentProperty

  • : v7
  • : Place in the Advanced Initialization Script of the Form
  • :

    for (var i = 0; i < widgets.length; ++i) {
    if (widgets[i].type == "upload") {
    widgets[i].config.select = function onSelect(e) {
    $.each(e.files, function (index, value) {
    if (value.size > 5000000) {
    e.preventDefault();
    alert("Document too large (>5mb) - please resize the document and try again.");
    }
    });
    };
    }
    }

Customaware Systems LLC
Customaware Systems LLC
Customaware Systems LLC is a Mongolian based software development company specialising in custom web based business applications and websites.

Leave a Reply

Your email address will not be published. Required fields are marked *