You don't actually upload the image files, because they reside on another server.
After you have displayed the images on your page, you have to implement your client side select logic and save the image urls to an array or hidden input field, it depends if you want to use ajax or an usual postback in order to save them on the server.
Here is a javascript example how to select images and store them into an array or whatever:
$(function () {
var imageUrls = [];
$(".imageContainer img").on("click", function () {
var $img = $(this);
var url = $img.attr("src");
var index = imageUrls.indexOf(url);
if (index === -1) {
imageUrls.push(url);
$img.addClass("selected");
} else {
imageUrls.splice(index, 1);
$img.removeClass("selected");
}
console.dir(JSON.stringify(imageUrls));
})
});
div{
margin-top:60px;
}
img{
height:80px;
}
.selected{
border: 3px solid green;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<div class="imageContainer">
<img src="http://i.imgur.com/nN8NqpI.gif" />
<img src="http://i.imgur.com/vj8HEPl.jpg" />
</div>
</body>
</html>
Transfering the urls to the server depends on, if you want to use ajax or a normal postback.
On the server you can the do something like this (C#), I don't know the PHP API.
But the important thing here, that you only have to submit the urls, there are no files to upload!
using (WebClient client = new WebClient())
{
foreach (var url in urlArray)
{
client.DownloadFileAsync(url, "aNameForTheImage");
}
}