public function addFile(\Filehosting\File $file)
 {
     $sth = $this->dbh->prepare("INSERT INTO files(filename, size, upload_time, comment, token, original_name)\n         VALUES(:filename, :size, :upload_time, :comment, :token, :original_name)");
     $sth->bindValue(":filename", $file->getFileName());
     $sth->bindValue(":size", $file->getSize());
     $sth->bindValue(":upload_time", date("Y-m-d H:i:s", $file->getUploadTime()));
     $sth->bindValue(":comment", $file->getComment());
     $sth->bindValue(":token", $file->getToken());
     $sth->bindValue(":original_name", $file->getOriginalName());
     $sth->execute();
     $id = $this->dbh->lastInsertId();
     return $id;
 }
 public function getFormattedSize(\Filehosting\File $file)
 {
     $size = $file->getSize();
     if ($size / 1000000 >= 1) {
         $size = round($size / 1000000, 1);
         return "{$size} Мб";
     }
     if ($size / 1024 >= 1) {
         $size = round($size / 1000, 1);
         return "{$size} Кб";
     }
     return $size . " байт";
 }