Example #1
0
 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;
 }
Example #2
0
 public function getFormattedTime(\Filehosting\File $file)
 {
     $time = $file->getUploadTime();
     return date("H:i M d, Y", $time);
 }