version 1.1, 2015/06/18 20:19:18
|
version 1.2, 2019/08/07 16:08:17
|
Line 36 to do this check on the client before up
|
Line 36 to do this check on the client before up
|
|
|
INPUT: |
INPUT: |
fileInput - |
fileInput - |
<input type="file" class="flUpload" /> |
<input type="file" class="LC_flUpload" /> |
Using the class "flUpload" is needed to use the event handlers below. |
Using the class "LC_flUpload" is needed to use the event handlers below. |
maxSize - |
maxSize - |
Maximum upload size in bytes. It is usually calculated from quota and |
Maximum upload size in bytes. It is usually calculated from quota and |
disk usage. |
disk usage. |
Line 77 function clearFileInput(ctrl) {
|
Line 77 function clearFileInput(ctrl) {
|
|
|
/* |
/* |
This block adds event listeners to file upload elements. It looks for input |
This block adds event listeners to file upload elements. It looks for input |
elements with class="flUpload". |
elements with class="LC_flUpload". |
|
|
<input type="file" class="flUpload" /> |
<input type="file" class="LC_flUpload" /> |
|
|
It also looks for a hidden element with id="free_space" that contains the maximum |
It also looks for a hidden element with id="free_space" that contains the maximum |
upload size. |
upload size. |
Line 91 checks if it is allowed based on size.
|
Line 91 checks if it is allowed based on size.
|
*/ |
*/ |
$( document ).ready(function() { |
$( document ).ready(function() { |
var maxSize = $( "#free_space" ).val(); |
var maxSize = $( "#free_space" ).val(); |
var upload_elements = $( ".flUpload" ); |
var upload_elements = $( ".LC_flUpload" ); |
for (var i=0; i<upload_elements.length; i++) { |
for (var i=0; i<upload_elements.length; i++) { |
upload_elements[i].addEventListener( "change", function(){ |
upload_elements[i].addEventListener( "change", function(){ |
checkUploadSize(this, maxSize); |
checkUploadSize(this, maxSize); |