This is quite tricky. Despite its name, the SFTP protocol is not actually a simple file transfer protocol with operations such as "upload file" and "download file".
Instead, it's a remote file system protocol featuring a POSIX-like API. This means that to a server, each transfer appears as a sequence of calls to methods that look somewhat like this:
Handle OpenFile(string path, OpenMode openMode, AccessMode accessMode);
int Read(Handle handle, long position, byte buffer, int offset, int count);
void Write(Handle handle, long position, byte buffer, int offset, int count);
void Close(Handle handle);
The problem with this is the fact that when the client opens a file for reading or writing, the server doesn't get any idea about what it actually intends to do. If the client opened the file for writing, the server doesn't know how many bytes the client is going to transfer. If the client opened the file for reading, the server doesn't know whether the client actually intends to download the whole file, or only a part of it. Additionally, it's perfectly acceptable for client to access random parts of the file, and even to perform both write and read requests.
This said, if both the SFTP client and SFTP server are under your control and based on Rebex components, the most sensible way to achieve this would be to add a custom SFTP extension the client could use to transmit some "transfer info" structure, informing the server app about what it's trying to achieve or what's currently going on. The server app could in turn use this information to do whatever it needs.
Do you think this approach would be usable in your scenario? Rebex SFTP and Rebex File Server currently don't support custom extensions, but we will consider adding that.