summaryrefslogtreecommitdiff
path: root/actions/apiaccountupdateprofileimage.php
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2009-11-06 17:21:08 -0800
committerZach Copley <zach@status.net>2009-11-06 17:21:08 -0800
commitb522c401e66e5b5d7e000c1bf25fd4b4a4d0558f (patch)
tree1140fcb28c1e7bd3dca8c088565b68125a0c26fd /actions/apiaccountupdateprofileimage.php
parentf7b0017f219d649a3acb3d650cb6d4fbb79b9956 (diff)
Better workaround for PHP returning empty $_POST and $_FILES when
POST length > post_max_size in php.ini. I also added this check to avatar upload, which was failing with huge files.
Diffstat (limited to 'actions/apiaccountupdateprofileimage.php')
-rw-r--r--actions/apiaccountupdateprofileimage.php20
1 files changed, 13 insertions, 7 deletions
diff --git a/actions/apiaccountupdateprofileimage.php b/actions/apiaccountupdateprofileimage.php
index 416fee45a..72fb361bf 100644
--- a/actions/apiaccountupdateprofileimage.php
+++ b/actions/apiaccountupdateprofileimage.php
@@ -87,16 +87,22 @@ class ApiAccountUpdateProfileImageAction extends ApiAuthAction
return;
}
- if (empty($this->user)) {
- $this->clientError(_('No such user!'), 404, $this->format);
+ // Workaround for PHP returning empty $_POST and $_FILES when POST
+ // length > post_max_size in php.ini
+
+ if (empty($_FILES)
+ && empty($_POST)
+ && ($_SERVER['CONTENT_LENGTH'] > 0)
+ ) {
+ $msg = _('The server was unable to handle that much POST ' .
+ 'data (%s bytes) due to its current configuration.');
+
+ $this->clientError(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
return;
}
- // Workaround for PHP returning empty $_FILES when POST length > PHP settings
-
- if (empty($_FILES) && ($_SERVER['CONTENT_LENGTH'] > 0)) {
- common_debug('content-length = ' . $_SERVER['CONTENT_LENGTH']);
- $this->clientError(_('Unable to handle that much POST data!'));
+ if (empty($this->user)) {
+ $this->clientError(_('No such user!'), 404, $this->format);
return;
}