Try using copy() instead of rename():
<?php
$target_path = "uploads/";
if (@file_exists($target_path . $filename)) {
//Rename the file to an MD5 version
copy($target_path.$filename, $target_path.$hashedfilename);
echo "The file ". basename( $filename ). "has been uploaded. Your file is <a href='$target_path.$hashedfilename'>here</a>.";
}
You could then delete the old file if you wanted to after it is copied by using unlink().
Also, what does $filename contain? Is it literally just a filename, like foo.exe, or is it a path + a filename, like path/to/foo.exe? If it's a path and a filename, then I understand why you're using basename() in your echo statement, but if it's just a filename, you shouldn't need basename(). Not that this will fix your problem, but I was just wondering.