Get multiple category names from permalink

The function get_category_parents will get you a string of the parent categories given the ID of a child category. So, like this:

$cat = $wp_query->get_queried_object();
$catid = $cat->cat_ID;
$parentcats = get_category_parents ($catid, false, '|', false);

This will give you something like category1|category2|category3. Follow the link above to see what other options you have. If you want to do more complicated stuff, you could split the string using explode.