2 function userupload($input, $target = NULL, $filename = NULL)
4 switch ($input['error']) {
7 case UPLOAD_ERR_NO_FILE:
10 throw new Exception('bestand niet goed ontvangen: '.$input['error']);
14 if (!file_exists($target) and !@mkdir($target, 0777, TRUE)) {
15 throw new Exception("bestand kon niet geplaatst worden in $target");
19 if (isset($filename)) {
23 $target .= $input['name'];
26 if (!@move_uploaded_file($input['tmp_name'], $target)) {
27 throw new Exception('bestand kon niet worden opgeslagen');
30 foreach (@glob('thumb/*/') as $thumbres) {
31 # attempt to remove old derivations
32 @unlink($thumbres . '/' . $target);