@@ 256-265 (lines=10) @@ | ||
253 | * |
|
254 | * @return string |
|
255 | */ |
|
256 | public function saveContent($path, $name, $content, $overwriteStrategy = self::STRATEGY_KEEP) |
|
257 | { |
|
258 | $filePath = $this->createFilePath($path, $name, $overwriteStrategy); |
|
259 | $absoluteFilePath = $this->getAbsolutePath($filePath); |
|
260 | ||
261 | file_put_contents($absoluteFilePath, $content); |
|
262 | unset($content); |
|
263 | ||
264 | return $filePath; |
|
265 | } |
|
266 | ||
267 | /** |
|
268 | * Save $upload file to $path in upload folder. |
|
@@ 278-286 (lines=9) @@ | ||
275 | * |
|
276 | * @return string |
|
277 | */ |
|
278 | public function saveUpload($path, UploadedFile $upload, $overwriteStrategy = self::STRATEGY_KEEP) |
|
279 | { |
|
280 | $filePath = $this->createFilePath($path, $upload->name, $overwriteStrategy); |
|
281 | $absoluteFilePath = $this->getAbsolutePath($filePath); |
|
282 | ||
283 | $upload->saveAs($absoluteFilePath); |
|
284 | ||
285 | return $filePath; |
|
286 | } |
|
287 | ||
288 | /** |
|
289 | * Move or copy file. |
|
@@ 298-306 (lines=9) @@ | ||
295 | * |
|
296 | * @return string |
|
297 | */ |
|
298 | protected function saveFileInternal($path, $absoluteFilePath, $overwriteStrategy, $function) |
|
299 | { |
|
300 | $filePath = $this->createFilePath($path, pathinfo($absoluteFilePath, PATHINFO_BASENAME), $overwriteStrategy); |
|
301 | $newAbsoluteFilePath = $this->getAbsolutePath($filePath); |
|
302 | ||
303 | $function($absoluteFilePath, $newAbsoluteFilePath); |
|
304 | ||
305 | return $filePath; |
|
306 | } |
|
307 | ||
308 | /** |
|
309 | * Save $absoluteFilePath file to $path in upload folder. |