- Create a new php file using any IDE of your choice ( Netbeans,Dreamweaver etc)
- Write the following code inside the file.
- Save in htdocs folder under XAMP.
- Run the file by entering “Localhost” in the browser.
$image = file_get_contents('/image.jpg'); //Location of the file to pull
file_put_contents('./image.jpg', $image); //save the image on your server
Give the location of the file which you want to pull in the btrackets of
Enter the destination directory location inside the brackets of
$image is a variable which you can change the name as per your wish. The first parameter of
file_put_contants is the location where you want to save the file. After running the file, you can see a new file has been created at the location which you specified.