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.
1 parent 22a8d45 commit e2fb274Copy full SHA for e2fb274
controller/upload_file.rst
@@ -206,9 +206,13 @@ You can use the following code to link to the PDF brochure of a product:
206
use Symfony\Component\HttpFoundation\File\File;
207
// ...
208
209
- $product->setBrochureFilename(
210
- new File($brochuresDirectory.DIRECTORY_SEPARATOR.$product->getBrochureFilename())
211
- );
+ if (!$form->isSubmitted() && $product->getBrochureFilename()) {
+ $form->setData(['brochure' => new File($this->getParameter('brochures_directory').DIRECTORY_SEPARATOR.$product->getBrochureFilename())]);
+ }
212
+
213
+ if ($form->isSubmitted() && $form->isValid()) {
214
+ // ...
215
216
217
Creating an Uploader Service
218
----------------------------
0 commit comments