Added handling for bad requests to upload.php