Permalink
Browse files

Realistic max file upload size

8192 Tb
  • Loading branch information...
bloatware committed Nov 14, 2017
1 parent 6b38312 commit 970eb4037ec8ba4dd7a8cbcffe0850144e9ba138
Showing with 5 additions and 4 deletions.
  1. +1 −1 textpattern/lib/txplib_head.php
  2. +2 −1 textpattern/lib/txplib_misc.php
  3. +2 −2 textpattern/textpattern.js
@@ -122,7 +122,7 @@ function pagetop($pagetitle = '', $message = '')
'_txp_token' => form_token(),
'ajax_timeout' => (int) AJAX_TIMEOUT,
'prefs' => array(
'max_file_size' => (float) $file_max_upload_size,
'max_file_size' => $file_max_upload_size,
'max_upload_size' => real_max_upload_size(0),
'production_status' => get_pref('production_status'),
'do_spellcheck' => get_pref(
@@ -6923,5 +6923,6 @@ function real_max_upload_size($user_max, $php = true)
}
}
return $real_max;
// 2^53 - 1 is max safe Javascript integer, let 8192Tb
return number_format(min($real_max, pow(2, 53) - 1), 0, '.', '');
}
@@ -1799,8 +1799,8 @@ jQuery.fn.txpFileupload = function (options) {
if (!jQuery.fn.fileupload) return this
var form = this, fileInput = this.find('input[type="file"]'),
maxChunkSize = textpattern.prefs.max_upload_size || 1000000,
maxFileSize = textpattern.prefs.max_file_size || 1000000
maxChunkSize = Math.min(parseFloat(textpattern.prefs.max_upload_size || 1000000), Number.MAX_SAFE_INTEGER)
maxFileSize = Math.min(parseFloat(textpattern.prefs.max_file_size || 1000000), Number.MAX_SAFE_INTEGER)
form.fileupload($.extend({
paramName: fileInput.attr('name'),

0 comments on commit 970eb40

Please sign in to comment.