aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/upload.php24
-rw-r--r--system.php4
2 files changed, 23 insertions, 5 deletions
diff --git a/actions/upload.php b/actions/upload.php
index eeb68aba1..3357fe469 100644
--- a/actions/upload.php
+++ b/actions/upload.php
@@ -7,21 +7,39 @@
global $CONFIG;
require_once(dirname(__FILE__)."/resize.php");
-
+
// Get common variables
$access_id = (int) get_input("access_id");
$container_guid = (int) get_input('container_guid', 0);
if (!$container_guid)
$container_guid == $_SESSION['user']->getGUID();
-
+
$not_uploaded = array();
- $uploaded_images = array();
+ $uploaded_images = array();
+
+ // test to make sure at least 1 image was selected by user
+ $num_images = 0;
+ foreach($_FILES as $key => $sent_file) {
+ if (!empty($sent_file['name']))
+ $num_images++;
+ }
+ if ($num_images == 0) {
+ // have user try again
+ register_error('No images were selected. Please try again');
+ forward(get_input('forward_url', $_SERVER['HTTP_REFERER']));
+ }
+
foreach($_FILES as $key => $sent_file) {
if (!empty($sent_file['name'])) {
$name = $_FILES[$key]['name'];
$mime = $_FILES[$key]['type'];
+ //error_log('Name ' . $sent_file['name']);
+ //error_log('MIME ' . $sent_file['type']);
+ //error_log('error ' . $sent_file['error']);
+ //error_log('Size ' . $sent_file['size']);
+
//make sure file is an image
if ($mime == 'image/jpeg' || $mime == 'image/gif' || $mime == 'image/png' || $mime == 'image/pjpeg') {
//this will save to users folder in /image/ and organize by photo album
diff --git a/system.php b/system.php
index ed6370149..82a705932 100644
--- a/system.php
+++ b/system.php
@@ -72,12 +72,12 @@
<tr>
<td>Max File Upload Size</td>
<td><?php echo tp_readable_size(ini_get('upload_max_filesize')); ?></td>
- <td>Max size of the sum of images uploaded at once</td>
+ <td>Max size of an uploaded image</td>
</tr>
<tr>
<td>Max Post Size</td>
<td><?php echo tp_readable_size(ini_get('post_max_size')); ?></td>
- <td>Max post size - should be larger than above</td>
+ <td>Max post size = sum of images + html form</td>
</tr>
<tr>
<td>Max Input Time</td>