]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Detect "no file" upload error and, for now at least, ignore it gracefully.
authorBrion Vibber <brion@pobox.com>
Mon, 2 Nov 2009 17:08:26 +0000 (09:08 -0800)
committerBrion Vibber <brion@pobox.com>
Mon, 2 Nov 2009 17:10:06 +0000 (09:10 -0800)
This was triggering on non-AJAX form submissions for new notices, preventing them from being posted when they contained no attachments.

lib/imagefile.php
lib/mediafile.php

index 88f46148140b3d9904074e583d5dc74bc7fafc84..cd2f87e6bd5d331129355dd8351dc595292b6a09 100644 (file)
@@ -79,7 +79,12 @@ class ImageFile
             @unlink($_FILES[$param]['tmp_name']);
             throw new Exception(_('Partial upload.'));
             return;
+         case UPLOAD_ERR_NO_FILE:
+            // No file; probably just a non-AJAX submission.
+            return;
          default:
+            common_log(LOG_ERR, __METHOD__ . ": Unknown upload error " .
+                $_FILES[$param]['error']);
             throw new Exception(_('System error uploading file.'));
             return;
         }
index d4d184dd0fd37b79165e97ff452d9b0736c0e5e5..29d752f0c6c9a8489e7b209ea356af9677e07a07 100644 (file)
@@ -152,6 +152,9 @@ class MediaFile
             throw new ClientException(_('The uploaded file was only' .
                 ' partially uploaded.'));
             return;
+        case UPLOAD_ERR_NO_FILE:
+            // No file; probably just a non-AJAX submission.
+            return;
         case UPLOAD_ERR_NO_TMP_DIR:
             throw new ClientException(_('Missing a temporary folder.'));
             return;
@@ -162,6 +165,8 @@ class MediaFile
             throw new ClientException(_('File upload stopped by extension.'));
             return;
         default:
+            common_log(LOG_ERR, __METHOD__ . ": Unknown upload error " .
+                $_FILES[$param]['error']);
             throw new ClientException(_('System error uploading file.'));
             return;
         }