mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 02:09:39 +02:00
Story#113524121 - validate in web max file
This commit is contained in:
parent
6f4ff0fd46
commit
cf3fce8055
4 changed files with 15 additions and 30 deletions
|
@ -27,3 +27,17 @@ $(document).on 'page:change', ->
|
|||
form.find('.js-ident-tip').show()
|
||||
|
||||
$('.js-contact-form').trigger('restoreDefault')
|
||||
|
||||
$('[data-legal_document]').each (e)->
|
||||
fileInput = $(e.target)
|
||||
minSize = 1 * 1024 # 100kB
|
||||
maxSize = 8 * 1024 * 1024; # 8 MB
|
||||
fileInput.parent('form').submit (e) ->
|
||||
if (files = fileInput.get(0).files).length
|
||||
fileSize = files[0].size
|
||||
if fileSize < minSize
|
||||
alert 'Document size is less then 100kB bytes'
|
||||
return false
|
||||
else if fileSize < maxSize
|
||||
alert 'Document size is more then 8MB bytes'
|
||||
return false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue