diff options
author | Bharat Mediratta <bharat@menalto.com> | 2011-04-23 10:07:32 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2011-04-23 10:07:32 -0700 |
commit | 76a7ad3161be0994d7ba98e9dff9b317b2430bb3 (patch) | |
tree | c7b2f3d3f131f0529755c337ec6e08ae95a73f55 /modules/gallery/libraries | |
parent | ce2c6c3ada2854777891a7a8edec66b7b5be72ad (diff) |
Overhaul of the uploader code:
- Propagate size limits (including detecting memory limits from GD) down to the
Flash so that we don't even start uploads that won't work
- Improve the error messages to be more user meaningful and provide links to the
codex for errors
- Tell the user up front what the file size limit is.
Fixes #1638
Diffstat (limited to 'modules/gallery/libraries')
-rw-r--r-- | modules/gallery/libraries/Form_Uploadify.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/gallery/libraries/Form_Uploadify.php b/modules/gallery/libraries/Form_Uploadify.php index 27ab9684..3e35e380 100644 --- a/modules/gallery/libraries/Form_Uploadify.php +++ b/modules/gallery/libraries/Form_Uploadify.php @@ -48,6 +48,20 @@ class Form_Uploadify_Core extends Form_Input { $v->simultaneous_upload_limit = module::get_var("gallery", "simultaneous_upload_limit"); $v->movies_allowed = (bool) movie::find_ffmpeg(); $v->suhosin_session_encrypt = (bool) ini_get("suhosin.session.encrypt"); + + list ($toolkit_max_filesize_bytes, $toolkit_max_filesize) = graphics::max_filesize(); + + $upload_max_filesize = trim(ini_get("upload_max_filesize")); + $upload_max_filesize_bytes = num::convert_to_bytes($upload_max_filesize); + + if ($upload_max_filesize_bytes < $toolkit_max_filesize_bytes) { + $v->size_limit_bytes = $upload_max_filesize_bytes; + $v->size_limit = $upload_max_filesize; + } else { + $v->size_limit_bytes = $toolkit_max_filesize_bytes; + $v->size_limit = $toolkit_max_filesize; + } + return $v; } |