1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-12-04 20:08:02 +01:00

append a random number, if a file already exists on a board

This commit is contained in:
czaks 2015-04-23 05:06:34 +02:00
parent 4916869e4a
commit 68109155b3

View File

@ -549,6 +549,12 @@ elseif (isset($_POST['post'])) {
$file['file_id'] .= "-$i";
$file['file'] = $config['dir']['img_root'] . $board['dir'] . $config['dir']['img'] . $file['file_id'] . '.' . $file['extension'];
while (file_exists ($file['file'])) {
$file['file_id'] .= rand(0,9);
$file['file'] = $config['dir']['img_root'] . $board['dir'] . $config['dir']['img'] . $file['file_id'] . '.' . $file['extension'];
}
$file['thumb'] = $config['dir']['img_root'] . $board['dir'] . $config['dir']['thumb'] . $file['file_id'] . '.' . ($config['thumb_ext'] ? $config['thumb_ext'] : $file['extension']);
$post['files'][] = $file;
$i++;