How to Handle File Uploads

This is a companion discussion topic for the original entry at

What if the input type is not equal to file? How do I use Upload file or Send Keys?

Can anyone tell me if this code still works or if there is a better way of doing it now?

For example is this a better solution to use?