@@ -122,7 +122,7 @@ Finally, you need to update the code of the controller that handles the form::
122122 if ($form->isValid()) {
123123 // $file stores the uploaded PDF file
124124 /** @var Symfony\Component\HttpFoundation\File\UploadedFile $file */
125- $file = $product->getBrochure()
125+ $file = $product->getBrochure();
126126
127127 // Generate a unique name for the file before saving it
128128 $fileName = md5(uniqid()).'.'.$file->guessExtension();
@@ -135,13 +135,13 @@ Finally, you need to update the code of the controller that handles the form::
135135 // instead of its contents
136136 $product->setBrochure($filename);
137137
138- // persist the $product variable or any other work...
138+ // ... persist the $product variable or any other work
139139
140140 return $this->redirect($this->generateUrl('app_product_list'));
141141 }
142142
143143 return $this->render('product/new.html.twig', array(
144- 'form' => $form->createView()
144+ 'form' => $form->createView(),
145145 ));
146146 }
147147 }
@@ -150,10 +150,10 @@ There are some important things to consider in the code of the above controller:
150150
151151#. When the form is uploaded, the ``brochure `` property contains the whole PDF
152152 file contents. Since this property stores just the file name, you must set
153- its new value before persisting the changes of the entity.
153+ its new value before persisting the changes of the entity;
154154#. In Symfony applications, uploaded files are objects of the
155155 :class: `Symfony\\ Component\\ HttpFoundation\\ File\\ UploadedFile ` class, which
156- provides methods for the most common operations when dealing with uploaded files.
156+ provides methods for the most common operations when dealing with uploaded files;
157157#. A well-known security best practice is to never trust the input provided by
158158 users. This also applies to the files uploaded by your visitors. The ``Uploaded ``
159159 class provides methods to get the original file extension
@@ -163,7 +163,7 @@ There are some important things to consider in the code of the above controller:
163163 However, they are considered *not safe * because a malicious user could tamper
164164 that information. That's why it's always better to generate a unique name and
165165 use the :method: `Symfony\\ Component\\ HttpFoundation\\ File\\ UploadedFile::guessExtension `
166- method to let Symfony guess the right extension according to the file MIME type.
166+ method to let Symfony guess the right extension according to the file MIME type;
167167#. The ``UploadedFile `` class also provides a :method: `Symfony\\ Component\\ HttpFoundation\\ File\\ UploadedFile::move `
168168 method to store the file in its intended directory. Defining this directory
169169 path as an application configuration option is considered a good practice that
0 commit comments