Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Increase Manageable File Attachment Size to >300 kb [done]

Post your ideas & suggestions for new nuBuilder features or other improvements
Post Reply
pmjd
Posts: 132
Joined: Fri Mar 12, 2021 10:38 am
Has thanked: 3 times
Been thanked: 1 time

Increase Manageable File Attachment Size to >300 kb [done]

Unread post by pmjd »

Reading the docs it warns to keep attached files to below 300 kb due to nuBuilder converting them to JSON format.

Would it be possible to change this so the max file size could be bigger?
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Increase Manageable File Attachment Size to >300 kb

Unread post by kev1n »

Good idea! Using the latest version from Github (just nuform.js has changed), you can declare a nuOnFileLoad() function e.g. in the header and/or any form to override the maximum length check

Code: Select all

function nuOnFileLoad(id, file) {
  if (file.length > 12000000) {
    // 600KB
    nuMessage([
      nuTranslate("File is too large, cannot be saved. Must be under 600Kb"),
    ]);
    return false;
  }

  return true;
}
pmjd
Posts: 132
Joined: Fri Mar 12, 2021 10:38 am
Has thanked: 3 times
Been thanked: 1 time

Re: Increase Manageable File Attachment Size to >300 kb

Unread post by pmjd »

Great, thank you.

I'm looking at maybe using nuBuilder for a record system that would hold scanned PDF records of a a few MBs in size, do you know what the upper limit would be for uploaded file sizes in nuBuilder?
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Increase Manageable File Attachment Size to >300 kb

Unread post by kev1n »

AFAIK there is no limit but it simply doesn't make sense after a certain size, because it becomes too slow. It's best to try out different sizes and measure the times.
Post Reply