Skip to content

Commit 639ac1e

Browse files
committed
docs: add "Overwriting Existing File"
1 parent 8237344 commit 639ac1e

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

user_guide_src/source/libraries/uploaded_files.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,18 @@ You can specify a new filename by passing it as the second parameter:
324324

325325
.. literalinclude:: uploaded_files/017.php
326326

327+
By default, if the destination file already exists, a new filename will be used.
328+
For example, if **image_name.jpg** already exists in the directory, then the
329+
filename will be **image_name_1.jpg**.
330+
331+
Overwriting Existing File
332+
-------------------------
333+
334+
You can overwrite the existing file by passing ``true``
335+
as the third parameter:
336+
337+
.. literalinclude:: uploaded_files/022.php
338+
327339
Check if the File Moved
328340
-----------------------
329341

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
$file->move(WRITEPATH . 'uploads', null, true);

0 commit comments

Comments
 (0)