$result = mysql_query("INSERT INTO files(FilmID,Name,MD5,Path,Size) VALUES({$filmid},'" . addslashes($name) . "','','" . addslashes($mypath) . "',{$fs})"); if ($result) { $_RESULT["ok"] = 1; } } } } else { if (is_dir($mypath_dec)) { $handle = opendir(realpath($mypath_dec)); while (false !== ($file = readdir($handle))) { $extension = pathinfo($file, PATHINFO_EXTENSION); if (!is_dir($mypath_dec . "/" . $file) && $file != "." && $file != ".." && in_array($extension, $includeExtensions)) { $md5 = $config['md5'] ? md5_file($mypath_dec . "/" . $file) : ""; $fs = $storages->getFileSize($mypath_dec . "/" . $file, false); $fpath = $movefile ? $mystorage . $directory . $suffix . "/" . $file : $mypath_dec . "/" . $file; $fpath = $storages->encode_path($fpath); $path_parts = pathinfo($fpath); $name = $path_parts["basename"]; $sql = "INSERT INTO files(FilmID,Name,MD5,Path,Size) VALUES({$filmid},'" . addslashes($name) . "','{$md5}','" . addslashes($fpath) . "',{$fs})"; $result = mysql_query($sql); } } closedir($handle); if ($movefile) { if (!urename($mypath_dec . "/", $mystorage . $directory . $suffix . "/")) { //файлы не скопировались } else { $_RESULT["ok"] = 1; } } else { $_RESULT["ok"] = 1;