I also would not recommend opening ssh port and adding files and scan them afterwards.
Use WebDAV instead.
Example about how to upload using curl can be found here:
Use it in many many scripts and it is reliable. My example is only about adding but can be extended.