Closed travisvalentine closed 11 years ago
Checking file size client side, at the moment isn't supported by all browser, so this kind of validation won't work everywhere. Check this for more details http://caniuse.com/#feat=fileapi Anyway can be a future implementation.
Out of the box client side validations is only meant to include the validations that are present in Rails core. This particular validation is not part of Rails so it would be subject to a plugin. Someone could create client_side_validations-paperclip that would include the file validation or perhaps a more general client_side_validations-attachment that would work with both Paperclip and Carrierwave. I'll close this as it is not an issue with ClientSideValidations but I am happy to continue the conversation.
Ah right, makes sense. Thanks for the prompt reply.
Just highlighting this for developers searching for Paperclip and client side validations for attachment file size and Content-Type, check out the wiki page section: https://github.com/DavyJonesLocker/client_side_validations/wiki/Paperclip#size-and-content-validation
@eliotsykes thanks
Since CSV is supposed to support IE >= 8, could you please clarify browser compatibility and that developer is supposed to implement an alternative way to load it without turbolinks?
Hi @tagliala - thanks that section has been there a long time, not written by me. I added notes today that's all. I'll add what I can from what you suggested.
Thanks.
size: { in: 0..10.megabytes }
Does this work? I'm seeing that javascript only checks for less_than_or_equal_to
@tagliala - that wouldn't work as is, nor would less_than
or the other possible options, it'd need modifying. I've adjusted the original code snippets to similar to what I'm using locally. Its now using less_than
, and this would not work with other options, it would need further modification.
I see in the wiki that there is a way to
validate_presence_of
a file uploaded with Paperclip, but was wondering if there was a way to validate the file's size.