restrict file upload size on site

This commit is contained in:
Evert Prants 2017-08-31 14:36:40 +03:00
parent 12f89ade59
commit a2bea009a2
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
3 changed files with 34 additions and 27 deletions

View File

@ -34,6 +34,36 @@ footer
color: #03A9F4
text-shadow: 2px 2px 1px #0059a0
margin-right: 5px
.socialbtn
width: 28px
height: 28px
display: inline-block
line-height: 28px
color: #fff
font-size: 160%
border-radius: 100px
padding: 2px
margin: 5px
&#github
background-color: #000
&#twitter
background-color: #03a9f4
&#discord
background-color: #2C2F33
.discordlogo
position: relative
top: 3px
background: url(/static/image/Discord-Logo-White.svg)
width: 22px
height: 22px
display: inline-block
i
position: relative
right: 1px
span.divider
color: #ddd
margin: 0 5px
cursor: default
@media all and (max-width: 800px)
footer

View File

@ -456,33 +456,6 @@ span.load
cursor: help
font-size: 19px
.socialbtn
width: 28px
height: 28px
display: inline-block
line-height: 28px
color: #fff
font-size: 160%
border-radius: 100px
padding: 2px
margin: 5px
&#github
background-color: #000
&#twitter
background-color: #03a9f4
&#discord
background-color: #2C2F33
.discordlogo
position: relative
top: 3px
background: url(/static/image/Discord-Logo-White.svg)
width: 22px
height: 22px
display: inline-block
i
position: relative
right: 1px
.dialog-drop
display: block
position: fixed

View File

@ -8,6 +8,8 @@
.inputting
h3 Upload new
.message.error
small Max filesize: 1 MB, only .png and .jpg allowed
br
input(type="file", id="fileinput")
.editor(style="display: none")
h3 Crop the image
@ -125,6 +127,8 @@ script.
message('This browser doesn\'t seem to support the `files` property of file inputs.')
} else if (!input.files[0]) {
message('Please select a file.')
} else if (input.files[0].size > 1000000) {
message('This file is too big. Max: 1 MB')
} else {
file = input.files[0]
fr = new FileReader()