4854: Infusion uploader integrated into file manager
[acontent.git] / docs / include / classes / FileUtility.class.php
index 04213c1..b2e0df4 100644 (file)
@@ -407,5 +407,22 @@ class FileUtility {
                        readfile($filename);
                }
        }
+       
+       /**
+     * This function handles ajax request and return an array of errors encoded in JSON
+     * @param   int     HTTP Status code, so far, handle 200 and 500.
+     */
+    public static function handleAjaxUpload($statusCode) {
+        if ($_POST['type'] === 'ajax') {
+            if ($statusCode === 500) {
+    //            $msg->printErrors();
+                header("HTTP/1.1 500 Internal Server Error", TRUE, 500);
+            } elseif ($statusCode === 200) {
+    //            $msg->printFeedbacks();
+                header("HTTP/1.1 200 Ok", TRUE, 200);
+            }
+            exit;
+        }
+    }
 }
 ?>
\ No newline at end of file