@@ -307,20 +307,46 @@ version, use ``getMimeType()`` instead:
307307Moving Files
308308============
309309
310+ with Original Filename
311+ ----------------------
312+
310313Each file can be moved to its new location with the aptly named ``move() `` method. This takes the directory to move
311314the file to as the first parameter:
312315
313316.. literalinclude :: uploaded_files/016.php
314317
315- By default, the original filename was used. You can specify a new filename by passing it as the second parameter:
318+ By default, the original filename was used.
319+
320+ with New Filename
321+ -----------------
322+
323+ You can specify a new filename by passing it as the second parameter:
316324
317325.. literalinclude :: uploaded_files/017.php
318326
327+ Overwriting Existing File
328+ -------------------------
329+
330+ By default, if the destination file already exists, a new filename will be used.
331+ For example, if **image_name.jpg ** already exists in the directory, then the
332+ filename will be **image_name_1.jpg ** automatically.
333+
334+ You can overwrite the existing file by passing ``true ``
335+ as the third parameter:
336+
337+ .. literalinclude :: uploaded_files/022.php
338+
339+ Check if the File Moved
340+ -----------------------
341+
319342Once the file has been removed the temporary file is deleted. You can check if a file has been moved already with
320343the ``hasMoved() `` method, which returns a boolean:
321344
322345.. literalinclude :: uploaded_files/018.php
323346
347+ When Moving Fails
348+ -----------------
349+
324350Moving an uploaded file can fail, with an HTTPException, under several circumstances:
325351
326352- the file has already been moved
0 commit comments