/** * Constructs the class with the minimal requeriments to upload a single file sucessfuly * @param array $uploadedFile the uploaded file $_FILES['file'] * @param string $targetDirectory if the given dictory do not exists, the class tries to create */ public function __construct(array $uploadedFile, $targetDirectory) { $this->uploadedFile = new UploadedFile($uploadedFile); $this->upload = new Upload($this->uploadedFile); $this->upload->setTargetDirectory($targetDirectory); $this->upload->setFileNewName($this->uploadedFile->getFileName()); }