We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 4b2b009 + 1c85007 commit 81338b5Copy full SHA for 81338b5
controller/upload_file.rst
@@ -217,9 +217,13 @@ You can use the following code to link to the PDF brochure of a product:
217
use Symfony\Component\HttpFoundation\File\File;
218
// ...
219
220
- $product->setBrochureFilename(
221
- new File($brochuresDirectory.DIRECTORY_SEPARATOR.$product->getBrochureFilename())
222
- );
+ if (!$form->isSubmitted() && $product->getBrochureFilename()) {
+ $form->setData(['brochure' => new File($this->getParameter('brochures_directory').DIRECTORY_SEPARATOR.$product->getBrochureFilename())]);
+ }
223
+
224
+ if ($form->isSubmitted() && $form->isValid()) {
225
+ // ...
226
227
228
Creating an Uploader Service
229
----------------------------
0 commit comments