diff options
| author | 2026-07-10 07:04:52 +0000 | |
|---|---|---|
| committer | 2026-07-10 07:04:52 +0000 | |
| commit | 81cce7f517246080bbcf2d4faadc3f982c5415f4 (patch) | |
| tree | 65b0f95ffef4bc55e43ac5e5ae1d69238eed34f3 | |
| parent | rework remap_files a bit (diff) | |
| download | hostfiles-81cce7f517246080bbcf2d4faadc3f982c5415f4.tar.gz hostfiles-81cce7f517246080bbcf2d4faadc3f982c5415f4.tar.bz2 hostfiles-81cce7f517246080bbcf2d4faadc3f982c5415f4.zip | |
rework die_error a bit
| -rw-r--r-- | upload.php | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -16,10 +16,7 @@ $c_t = strtolower($_SERVER['HTTP_CONTENT_TYPE'] ?? ''); if ($c_t == 'multipart/form-data' || 0 === strpos($c_t, 'multipart/form-data;')) { $FILES = remap_files(); if (!isset($FILES['file'])) { - header('Status: 406 Not Acceptable'); - header('Content-Type: text/plain'); - echo "You need to upload the file within the field name 'file' or 'file[]' if you want to use multipart/form-data.\n"; - exit; + die_error("You need to upload the file within the field name 'file[]' (or 'file' if there's only one) if you want to use multipart/form-data.", '406 Not Acceptable'); } foreach ($FILES['file'] as $file) { if (!is_uploaded_file($file['tmp_name'])) { @@ -101,10 +98,10 @@ function send_notification($note) { } -function die_error($s) { +function die_error($s, $status='500 Server Is 💩') { global $tmp_path, $filepath, $size; - header('Status: 500 Server Is 💩'); - echo $s; + header('Status: ' . $status); + echo $s . "\n"; error_log($s); @$debug = json_encode(array('s'=>$_SERVER, 'f'=>$_FILES, 't'=>$tmp_path, 'p'=>$filepath, 'size' => $size)); send_notification("[hostfil.es] $_SERVER[REMOTE_ADDR] ! $s\n$debug"); |
