Пример #1
0
 /**
  * Mutator method for the uploadedFile property.
  * Accepts the following inputs:
  * - An absolute string url (for fetching remote files).
  * - An array (data parsed from the $_FILES array),
  * - A Symfony uploaded file object.
  *
  * @param mixed $uploadedFile
  */
 public function setUploadedFile($uploadedFile)
 {
     if (!$this->keep_old_files) {
         $this->clear();
     }
     if ($uploadedFile == STAPLER_NULL) {
         $this->clearAttributes();
         return;
     }
     $this->uploadedFile = FileFactory::create($uploadedFile);
     $this->instanceWrite('file_name', $this->uploadedFile->getFilename());
     $this->instanceWrite('file_size', $this->uploadedFile->getSize());
     $this->instanceWrite('content_type', $this->uploadedFile->getMimeType());
     $this->instanceWrite('updated_at', date('Y-m-d H:i:s'));
     $this->queueAllForWrite();
 }