Preheat oven to 350°F (175°C) and line a cupcake pan with liners.
In a bowl, whisk together flour, baking powder, baking soda, and salt.
In another bowl, beat butter and sugar until light and fluffy. Add eggs one at a time, mixing well.
Mix in pineapple, coconut, and milk.
Gradually add dry ingredients to wet mixture and mix until just combined.
Fill cupcake liners about 2/3 full and bake for 18-20 minutes.
For frosting, beat butter and cream cheese until smooth. Add powdered sugar and milk, and mix until fluffy. Stir in shredded coconut.
Frost cooled cupcakes and sprinkle with toasted coconut flakes.