@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | $this->aUserFiles = []; |
41 | 41 | $this->aFiles = []; |
42 | 42 | |
43 | - foreach($_FILES as $sVarName => $aFile) |
|
43 | + foreach ($_FILES as $sVarName => $aFile) |
|
44 | 44 | { |
45 | 45 | $this->aFiles[$sVarName] = []; |
46 | - if(is_array($aFile['name'])) |
|
46 | + if (is_array($aFile['name'])) |
|
47 | 47 | { |
48 | - for($i = 0; $i < count($aFile['name']); $i++) |
|
48 | + for ($i = 0; $i < count($aFile['name']); $i++) |
|
49 | 49 | { |
50 | 50 | // Copy the file data into the local array |
51 | 51 | $this->aFiles[$sVarName][] = [ |
@@ -149,25 +149,25 @@ discard block |
||
149 | 149 | // Default upload dir |
150 | 150 | $sDefaultUploadDir = $this->getOption('upload.default.dir'); |
151 | 151 | // Check validity of the uploaded files |
152 | - foreach($this->aFiles as $sVarName => $aFiles) |
|
152 | + foreach ($this->aFiles as $sVarName => $aFiles) |
|
153 | 153 | { |
154 | 154 | $this->aUserFiles[$sVarName] = []; |
155 | - foreach($aFiles as $aFile) |
|
155 | + foreach ($aFiles as $aFile) |
|
156 | 156 | { |
157 | 157 | // Verify upload result |
158 | - if($aFile['error'] != 0) |
|
158 | + if ($aFile['error'] != 0) |
|
159 | 159 | { |
160 | 160 | throw new \Jaxon\Exception\Error($this->trans('errors.upload.failed', $aFile)); |
161 | 161 | } |
162 | 162 | // Verify file validity (format, size) |
163 | - if(!$this->validateUploadedFile($sVarName, $aFile)) |
|
163 | + if (!$this->validateUploadedFile($sVarName, $aFile)) |
|
164 | 164 | { |
165 | 165 | throw new \Jaxon\Exception\Error($this->getValidatorMessage()); |
166 | 166 | } |
167 | 167 | // Verify that the upload dir exists and is writable |
168 | 168 | $sUploadDir = $this->getOption('upload.files.' . $sVarName . '.dir', $sDefaultUploadDir); |
169 | 169 | $sUploadDir = rtrim(trim($sUploadDir), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
170 | - if(!is_writable($sUploadDir)) |
|
170 | + if (!is_writable($sUploadDir)) |
|
171 | 171 | { |
172 | 172 | throw new \Jaxon\Exception\Error($this->trans('errors.upload.access')); |
173 | 173 | } |
@@ -176,9 +176,9 @@ discard block |
||
176 | 176 | } |
177 | 177 | } |
178 | 178 | // Copy the uploaded files from the temp dir to the user dir |
179 | - foreach($this->aFiles as $sVarName => $aFiles) |
|
179 | + foreach ($this->aFiles as $sVarName => $aFiles) |
|
180 | 180 | { |
181 | - for($i = 0; $i < count($aFiles); $i++) |
|
181 | + for ($i = 0; $i < count($aFiles); $i++) |
|
182 | 182 | { |
183 | 183 | // All's right, move the file to the user dir. |
184 | 184 | move_uploaded_file($aFiles[$i]["tmp_name"], $this->aUserFiles[$sVarName][$i]->path()); |