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:
parent
4916869e4a
commit
68109155b3
6
post.php
6
post.php
@ -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++;
|
||||
|
Loading…
Reference in New Issue
Block a user