]> git.p6c8.net - jirafeau.git/commitdiff
Add more details about upload error
authorJerome Jutteau <jerome@jutteau.fr>
Sun, 3 Jul 2022 08:42:33 +0000 (10:42 +0200)
committerJerome Jutteau <jerome@jutteau.fr>
Sun, 3 Jul 2022 08:54:01 +0000 (10:54 +0200)
ref #303

Signed-off-by: Jerome Jutteau <jerome@jutteau.fr>
lib/functions.php

index 1444c1f6401e9b233fc61ecb3787e41b5c87730a..46c004a101606e77623e07b860e6fa01bd8d35f2 100644 (file)
@@ -1008,6 +1008,11 @@ function jirafeau_async_push($ref, $data, $code, $max_file_size)
     if ($a['next_code'] != "$code") {
         return "Error: bad transfer code";
     }
+    if ($data['error'] != UPLOAD_ERR_OK) {
+        // Check error code in https://www.php.net/manual/en/features.file-upload.errors.php
+        $data_details = print_r($data, true);
+        return "Error: upload error: {$data_details}";
+    }
     if (empty($data['tmp_name'])) {
         return "Error: missing tmp_name";
     }

patrick-canterino.de