Do you have error reporting enabled on your server? If not add in these lines of code to the top of the page:
<?php
error_reporting(E_ALL);
ini_set('display_errors','on');
?>
With this on your page it should let you know if some other error is occurring. It seems like there might be an error occurring on the script level, maybe a permissions issue for moving the uploaded file. If you have the folder set to 777 then there should not be any permissions issue with that folder at least. Please post back with the info after adding this to your page and also include the page in question in a zip archive so that we can examine it.