[0002781] Improved error diagnostic during files upload.
[fa-stable.git] / inventory / manage / items.php
index 54df94bf68969db2202871c05bdb4734385f68a9..e3d710ee054db4c40dae837b02b5082556f2cc9f 100644 (file)
@@ -64,6 +64,15 @@ if (isset($_FILES['pic']) && $_FILES['pic']['name'] != '')
                mkdir($filename);
        }       
        $filename .= "/".item_img_name($stock_id).".jpg";
+
+  if ($_FILES['pic']['error'] == UPLOAD_ERR_INI_SIZE) {
+    display_error(_('The file size is over the maximum allowed.'));
+               $upload_file ='No';
+  }
+  elseif ($_FILES['pic']['error'] > 0) {
+               display_error(_('Error uploading file.'));
+               $upload_file ='No';
+  }
        
        //But check for the worst 
        if ((list($width, $height, $type, $attr) = getimagesize($_FILES['pic']['tmp_name'])) !== false)