We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d6d7a1e commit a4e889bCopy full SHA for a4e889b
1 file changed
website/user_profile/templates/create.html
@@ -32,7 +32,7 @@
32
</div>
33
<hr>
34
<div>
35
- {% render_field form.image class="form-control mt-4" style="background:white;" placeholder="Select An Image To Upload" %}
+ {% render_field form.image class="form-control mt-4" style="background:white;" placeholder="Select An Image To Upload" onchange="ValidateSize(this)" type="file"%}
36
37
38
</table>
@@ -49,4 +49,18 @@
49
50
51
</body>
52
+
53
+<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
54
+<script>
55
+ function ValidateSize(file) {
56
+ var FileSize = file.files[0].size / 1024 / 1024; // in MB
57
+ if (FileSize > 2) {
58
+ alert('File size exceeds 2 MB');
59
+ $(file).val('');
60
+ } else {
61
62
+ }
63
64
+</script>
65
66
{% endblock %}
0 commit comments