Ну ладно.
Как-то так:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>File attachment</title>
</head>
<body>
<form id="files" action="/send-a-file" method="post">
<input type="file" class="attach-more">
<input type="file" class="attach-more">
</form>
<script>
$("#files").bind("change", function(event) {
var max_attachments_size_allowed = 5 * 1024 * 1024; //5мб
var attachments_size = 0;
$('#files input[type=file]').each(function() {
attachments_size += this.files[0].size;
});
if (attachments_size > max_attachments_size_allowed) {
$('#err_attach').html('Размер вложений ограничен 5 мб!');
event.target.value = '';
}
})
</script>
</body>
</html>