PHP - how to move images from one folder to another using php

Asked By Olusegun A. on 07-Oct-10 03:10 PM
How do i move or copy a file that is already in one of my website online folders to another.
DL M replied to Olusegun A. on 09-Oct-10 04:11 AM
pradeep joshi replied to Olusegun A. on 13-Jan-11 06:12 AM


     Hi,
 
    There is a very simple way to move an image from one folder to another and the code for that is

    <?php
       
         rename("folder_a/image1.jpg","folder_b/image2.jpg");
     ?>

   rename() function folder move from one folder to another.
   In this example image1.jpg is moving from folder_a to image2.jpg in folder_b

 
pradeep joshi replied to Olusegun A. on 13-Jan-11 06:18 AM


     You can move other file also like .Doc, .txt, .xls, .ppt files also.