upload image in php getting the url code example
Example 1: php upload from url
<?php
if(isset($_POST['get_image']))
{
$url=$_POST['img_url'];
$data = file_get_contents($url);
$new = 'images/new_image.jpg';
file_put_contents($new, $data);
echo "<img src='images/new_image.jpg'>";
}
?>
Example 2: how to upload image in php
<!DOCTYPE html><html><body><form action="upload.php" method="post"
enctype="multipart/form-data"> Select image to upload: <input type="file" name="fileToUpload" id="fileToUpload"> <input type="submit" value="Upload Image" name="submit">
</form></body></html>