Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
6 replies
Subscribers
7 subscribers
Views
5737 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
User Interface
Query on File Size Limit
joanneh
over 8 years ago
While creating the File Upload function in ui, may I know if there is anyway to SET PARTICULAR LIMIT to the size of file being upload?
Thanks.
OriginalPostID-233969
Discussion posts and replies are publicly visible
0
kdimitrov
over 8 years ago
Hi there,
There's a small hack that allows you to access the temporary document uploaded and do validation on it. It involves having a "fake" SAIL component with the variable, please find below an example:
= with(
local!doc: todocument(55),
local!docSize: a!fileUploadField(
value: local!doc
).uploadedDocumentSize,
local!tempSize
)
You can use this local variable to perform validation as usual.
Hope that is useful.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
venkateshs329
over 8 years ago
#joanneh: Please try below code
a!fileUploadField(
label:"Document ",
value:ri!doc,
saveInto:ri!doc,
validations:if(isnull(ri!doc),{},{if((document(ri!doc,"size")/1024>1024),"validation message goes here","")})
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Mike Schmitt
Certified Lead Developer
over 8 years ago
@kdimitrov's suggestion is probably the way to go for this. I would like to expand on it and point out that, when the filesize is accessed this way, the result is actually a text value, and its context changes depending on the size, i.e. with different suffixes like "kb", "mb", etc. The best way to handle this, I believe, would be to write a separate function in an expression rule where the various possibilities are parsed and converted to an integer value of bytes, since then that can be easily compared to a constant, etc.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
joanneh
over 8 years ago
@mschmitt @venkateshs329 @kdimitrov,
Thank you for your help.
However, would there be anyway to make it applicable to files which are uploaded from user's own PC (i.e. files are not pre-exist in document Communities )?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
siddharthg837
over 8 years ago
Hi @joanneh - the a!fileUploadField () component (as mentioned in above comments) are used to upload files directly from the users own machine and doesn't require the document to present already on the Appian document Community.
Thanks, hope this helps !
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Mike Schmitt
Certified Lead Developer
over 8 years ago
@joanneh: to clarify, the trick mentioned at the top of the thread is specifically for validation of on-form uploaded files (just the example posted used an already-uploaded document ID for ease of demonstration). Much more info can be found in this older thread, too: /search?q=OriginalPostID-153370
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel