Answer the question
In order to leave comments, you need to log in
How to catch file size before uploading to server?
Found this code
<input type="file" id="loadfile" />
<input type="button" value="find size" onclick="findSize()" />
<script type="text/javascript">
function findSize() {
var fileInput = $("#loadfile")[0];
alert(fileInput.files[0].size); // Size returned in bytes.
}
</script>
models.ImageField(upload_to='static/photo')
<form enctype="multipart/form-data" action="albompho" method="post">
{% csrf_token %}
{{ phal }}
<input class="button" type="submit" value="Завантажити">
</form>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question