presento/public/fetch.php

15 lines
296 B
PHP
Raw Normal View History

2021-01-27 19:23:49 +00:00
<?php
$directory = "./uploads/audited";
$old_files = array_diff(scandir($directory), array('..', '.'));
$files=[];
foreach($old_files as $file) {
$files[] = $file;
}
if(empty($files)) {
die();
}
$random_index = rand(0, count($files)-1);
echo("/uploads/audited/".$files[$random_index]);