You can use pathinfo() to get the information: http://php.net/manual/en/function.pathinfo.php
<?php
$path_parts = pathinfo('http://remote.website/images/test.jpg');
echo $path_parts['dirname'], "\n";
echo $path_parts['basename'], "\n";
echo $path_parts['extension'], "\n";
echo $path_parts['filename'], "\n";
?>
but you still don't have a TempName because you're not uploading a file, if you need it, you should generate that on your own when youdownload the file to the server, here's a simple example:
<?php
$url = 'http://remote.website/images/test.jpg'; # $_POST['link']
$getFile = pathinfo($url);
$fileName = $getFile['filename']; # without extension
$fileTempName = sha1(microtime().uniqid('',true)); # random name
$image = file_get_contents($url);
$wr = fopen('/var/www/path/images/'.$fileTempName.'.jpg', 'w+');
fputs($wr, $image);
fclose($wr);
unset($image);
?>
This will download and rename the image to the images/ directory, or wherever you want, in order to upload to Amazon S3. You should check at least if file exists, and if the file is really an image.