- $result = userupload($_FILES['image'], $target);
- $html .= sprintf('<p><img src="/thumb/640x/%s" /></p>', $result);
+ if ($result = userupload($_FILES['image'], $target)) {
+ $reply['raw'] .= "/$result";
+ if (preg_match('(^image/)', $_FILES['image']['type'])) {
+ $reply['message'] .= sprintf('<p><img src="/thumb/640x/%s" /></p>', $result);
+ }
+ else {
+ $reply['message'] .= sprintf('<p>Bijgevoegd bestand: <a href="/%s" />%s</a></p>',
+ $result, basename($result)
+ );
+ }
+ }