You cannot have any output before you send headers. Since you are outputting in displayimage.php, your location function will fail.
Here is some great reading on StackOverflow about this issue:
How to fix "Headers already sent" error in PHP
EDIT
You have a syntax error in your header call. You have an extra period. Remove the period after $newname. You should have:
header('Location: displayimage.php?img='.$newname);
Also, you have too many ( on your move_uploaded_file function. This is causing a syntax error as well. You should have:
move_uploaded_file($_FILES['userfile']['tmp_name'], $filepath);
Any time you do not see any output whatsoever, you usually have a syntax error. Just one syntax error will stop the entire page from executing.