I'd recommend looking into implementing flash messages in PHP. Basically, store the message in a session and display it to the user.
There are examples using third party code here. Or, you could also roll your own implementation. There's a really, really simple example here.
Displaying messages based on GET parameters works, but it can get messy as simply hitting a particular URL will display the message to the user.
Here are some functions I used a very long time ago for something like this (setting and printing session messages). I'd highly recommend looking into the links before using this:
function set_session_message($type, $message) {
$_SESSION['message'] = array('type' => $type, 'message' => $message);
}
function print_session_message() {
$output = '';
if (!empty($_SESSION['message'])) {
if ($_SESSION['message']['type'] == 'success') {
$output = '<p class="success">' . $_SESSION['message']['message'] . '</p>';
} elseif ($_SESSION['message']['type'] == 'error') {
$output = '<p class="error">' . $_SESSION['message']['message'] . '</p>';
}
}
unset($_SESSION['message']);
return $output;
}
With this, what you'd do is call set_session_message()
on successful upload, redirect to your index page, and then call print_session_message()
.