read()){ if(substr($r,0,1)!='.'){ $filePath = $DIR.'/'.$r; $filePathInfo = pathinfo($filePath); if(file_exists($filePath)){ $filename = preg_replace('/[^a-zA-Z0-9\-\._]/','', $filePathInfo['basename']); $filesize = (filesize($filePath) < 1000000) ? round(filesize($filePath) / 1000)."k" : round(filesize($filePath) / 1000000)."M"; $title = $filename; $path = '../../docs/'.$NEW; $dbPath = '/docs/'.$NEW; copy($filePath, "$path/$filename"); $query.="INSERT INTO files VALUES(null, '$title', '$filename', '".$dbPath."', '".date("Y-m-d", filemtime($filePath))."', '$filesize');\n"; } } } echo $query; //mysql_query($query); mysqli_close($conn);