From 76a7ad3161be0994d7ba98e9dff9b317b2430bb3 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 23 Apr 2011 10:07:32 -0700 Subject: 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 --- modules/gallery/libraries/Form_Uploadify.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'modules/gallery/libraries') 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; } -- cgit v1.2.3