SFTP: make it so files can be downloaded into resources or upload from resources

Fixes #428
However, this approach is more error prone, since you can miss the break. It is also one level deeper.