Bugfix: non-image file uploading

This commit is contained in:
Michael Save 2012-04-20 19:04:37 +10:00
parent d86875a3b9
commit 4c2066bc27

View File

@ -469,13 +469,11 @@ if (isset($_POST['delete'])) {
if ($config['redraw_image']) { if ($config['redraw_image']) {
$image->to($post['file']); $image->to($post['file']);
} else { } else {
if (!@move_uploaded_file($_FILES['file']['tmp_name'], $post['file'])) $dont_copy_file = true;
error($config['error']['nomove']);
} }
$image->destroy(); $image->destroy();
} else { } else {
// not an image // not an image
//copy($config['file_thumb'], $post['thumb']); //copy($config['file_thumb'], $post['thumb']);
$post['thumb'] = 'file'; $post['thumb'] = 'file';
@ -483,6 +481,11 @@ if (isset($_POST['delete'])) {
$post['thumbwidth'] = $size[0]; $post['thumbwidth'] = $size[0];
$post['thumbheight'] = $size[1]; $post['thumbheight'] = $size[1];
} }
if (!isset($dont_copy_file) || !$dont_copy_file) {
if (!@move_uploaded_file($_FILES['file']['tmp_name'], $post['file']))
error($config['error']['nomove']);
}
} }
if ($post['has_file'] && $config['image_reject_repost'] && $p = getPostByHash($post['filehash'])) { if ($post['has_file'] && $config['image_reject_repost'] && $p = getPostByHash($post['filehash'])) {