How to download image from a URL using PHP

By | August 8, 2020
Are you creating an application where a candidate can register his profile and can upload his profile picture or you are creating an application where your system will download the file from given URL? if yes then you are at right place because here in this article i am going to writing a code that will copy the file from given URL and will store in a specified directory. So without wasting time, lets do it.

In this example, i am going use PHP inbuilt function copy() to copy the file from URL.

copy('', 'local/folder/local.jpg');

In above code, I have used two path first one for server path (a file URL which you want be copied) and second one is your local server directory path in which you want the file to be stored.

I hope this article will help you a lot.

Category: PHP

Leave a Reply

Your email address will not be published. Required fields are marked *