Skip to content

Commit f16d3ed

Browse files
icamysxabbuh
authored andcommitted
Minor fix in event (file uploading)
1 parent 2ad94ff commit f16d3ed

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

controller/upload_file.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,11 @@ logic to a separate service::
247247

248248
return $fileName;
249249
}
250+
251+
public function getTargetDir()
252+
{
253+
return $this->targetDir;
254+
}
250255
}
251256

252257
Then, define a service for this class:
@@ -447,9 +452,13 @@ controller.
447452
{
448453
$entity = $args->getEntity();
449454

455+
if (!$entity instanceof Product) {
456+
return;
457+
}
458+
450459
$fileName = $entity->getBrochure();
451460

452-
$entity->setBrochure(new File($this->targetPath.'/'.$fileName));
461+
$entity->setBrochure(new File($this->uploader->getTargetDir().'/'.$fileName));
453462
}
454463
}
455464

0 commit comments

Comments
 (0)