Exemplo n.º 1
0
 /**
  * @param $attachmentFile ReservationAttachment
  * @return int
  */
 public function AddReservationAttachment(ReservationAttachment $attachmentFile)
 {
     $command = new AddReservationAttachmentCommand($attachmentFile->FileName(), $attachmentFile->FileType(), $attachmentFile->FileSize(), $attachmentFile->FileExtension(), $attachmentFile->SeriesId());
     $id = ServiceLocator::GetDatabase()->ExecuteInsert($command);
     $extension = $attachmentFile->FileExtension();
     $attachmentFile->WithFileId($id);
     $fileSystem = ServiceLocator::GetFileSystem();
     $fileSystem->Add($fileSystem->GetReservationAttachmentsPath(), "{$id}.{$extension}", $attachmentFile->FileContents());
     return $id;
 }
Exemplo n.º 2
0
 /**
  * @param ReservationAttachment $attachment
  * @return void
  */
 public function BindAttachment(ReservationAttachment $attachment)
 {
     header('Content-Type: ' . $attachment->FileType());
     header('Content-Disposition: attachment; filename="' . $attachment->FileName() . '"');
     ob_clean();
     flush();
     echo $attachment->FileContents();
 }