X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/6c1705bd7fc4faa3db056d503afee041083ad754..ab3ebc53acde6f060649a01403a886f5485f7bf6:/login/edit.php diff --git a/login/edit.php b/login/edit.php index 15b0a2a..101244a 100644 --- a/login/edit.php +++ b/login/edit.php @@ -123,27 +123,19 @@ if ($_POST) { if (!isset($cols[$col]) and @$cols[$col]['type'] == 'file') { continue; # unknown } - switch ($val['error']) { - case UPLOAD_ERR_OK: - break; - case UPLOAD_ERR_NO_FILE: - continue 2; # current - default: - $colwarn[$col] = "Afbeelding niet goed ontvangen."; - continue 2; - } if (empty($cols[$col]['target'])) { $colwarn[$col] = "Kan niet worden aangepast."; continue; } - if (!@move_uploaded_file($val['tmp_name'], $cols[$col]['target'])) { - $colwarn[$col] = "Fout bij opslaan."; + try { + require_once('upload.inc.php'); + $target = userupload($val, $cols[$col]['target']); + if (!$target) continue; + $cols[$col]['value'] = ''; } - foreach (@glob('thumb/*/') as $thumbres) { - # attempt to remove old derivations - @unlink($thumbres.'/'.$cols[$col]['target']); + catch (Exception $e) { + $colwarn[$col] = $e->getMessage(); } - $cols[$col]['value'] = ''; } if (!empty($_POST['newpass'])) {