/** * @return string */ public function getFilename() { $contents = base64_decode($this->file); $mimeType = $this->getMimeType($contents); $extension = $this->fileUtility->lookupExtension($mimeType); return $this->buildFullFilename($extension); }
/** * @param $file * @return $this * @throws InvalidFileTypeException */ public function file($file) { $this->destroy(); if ($file instanceof UploadedFile) { $this->file = new FormUploadedFile($file); return $this; } if ($this->fileUtility->isBase64Encoded($file)) { $this->file = App::make(Base64EncodedFile::class, [$file]); return $this; } throw new InvalidFileTypeException('Invalid File Type Provided'); }