Limit upload size when creating a document

Hi All,

I'm trying to limit the upload size to 1GB in Nuxeo. Can someone of you explain how can I do that from Studio. It would be perfect also to be able to show a message when the file is bigger than 1GB saying that the file is not accepted because is bigger than 1GB.

I have no experience at all with Nuxeo Studio so please be nice :) and explicitly as much as possible.

Thank you

0 votes

1 answers

150 views

ANSWER



Hi!

So as far as I know and from reading other similar posts, there isn't an inherit means of limiting uploaded files. However this might be possible to achieve via automation chain.

  • First create an automation chain in studio
  • Fetch the input document
  • Set a variable to get the value from property “file:content” (assuming you are using this field to upload the binary)
  • Use RunScript operator to use javascript, to take Blob from the variable, and checking its size with Blob.length (will return length in bytes)
  • Have it where if the length is more than a certain value, set the property “file:content” to be null.
  • Set a UI alert operator to notify user the file is too big.
  • Make sure to create an event handler (before document modification) and assign your automation chain to it

This is a very broad solution I know, but I've yet to do this myself. This is just a general idea of what I might do in this situation, so feel free to take this with a grain of salt.

0 votes