Skip to content
This repository was archived by the owner on May 5, 2022. It is now read-only.

Commit fe0f924

Browse files
upload_max_filesize check before upload
getting the upload_max_filesize for a check before upload
1 parent 4dfc8d3 commit fe0f924

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

resources/app.js

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
1-
$( document ).ready(function() {
1+
$(document).ready(function() {
22
$('.file:even').addClass('even');
3-
$( ".field h1, .icon" ).click(function() {
3+
$(".field h1, .icon").click(function() {
44
$(this).parent().find(".innercont").toggleClass("hide");
55
$(this).parent().find(".icon").toggleClass("icon-up");
66
});
7-
$( "#uploadclick" ).click(function(e) {
7+
$("#uploadclick").click(function(e) {
88
var input, file;
99

10-
if (!window.FileReader) {
11-
alert("The file API isn't supported on this browser yet.");
12-
return;
13-
}
14-
15-
input = document.getElementById('fileinput');
16-
file = input.files[0];
17-
if (file.size > 1024 * 1024 * 10) {
18-
alert("Die Datei ist größer als 10MB!");
19-
e.preventDefault();
20-
}
21-
else {
22-
//
23-
}
24-
});
10+
if (!window.FileReader) {
11+
alert("The file API isn't supported on this browser yet.");
12+
return;
13+
}
14+
var filesize = parseInt($("#maxsize").text().slice(0,-3));
15+
input = document.getElementById('fileinput');
16+
file = input.files[0];
17+
if (file.size > 1024 * 1024 * $('#maxsize').text().slice(0,-3)) {
18+
alert("Die Datei ist größer als " + filesize + " MB!");
19+
e.preventDefault();
20+
} else {
21+
//nuttin
22+
}
23+
});
2524
});

0 commit comments

Comments
 (0)