Add support for pasting files. Close #903.