Make sure your path is correct. If it is, and your code still does not work, please instruct Tiny SFTP Server to log at Debug level and copy&paste the log here.
I just gave this a try and was unable to reproduce the issue. The file was created successfully. I used this C++ code for the client and compiled it on Linux using
gcc upload.cpp -lssh2 -o upload command. The app succeeded and created an empty file. My Tiny SFTP Server log looks like this:
15:00:12.103 Debug Server: Accepted connection from 10.0.0.42:52404.
15:00:12.113 Info Server: Session 1: Started on connection from 10.0.0.42:52404.
15:00:12.117 Debug SSH: Session 1: Local SSH version: SSH-2.0-RebexSSH_5.0.8062.0
15:00:12.130 Debug SSH: Session 1: Remote SSH version: SSH-2.0-libssh2_1.10.0
15:00:12.135 Debug SSH: Session 1: Performing algorithm negotiation and key exchange.
15:00:12.207 Debug SSH: Session 1: Performing key exchange using curve25519-sha256 with ssh-rsa.
15:00:12.252 Debug SSH: Session 1: Cipher info: SSH 2.0, curve25519-sha256, ssh-rsa, aes128-ctr/aes128-ctr, hmac-sha2-256/hmac-sha2-256
15:00:12.258 Debug SSH: Session 1: Key exchange finished.
15:00:12.268 Debug SSH: Session 1: Performing authentication.
15:00:12.280 Debug SSH: Session 1: Starting authentication as 'tester' for 'ssh-connection'.
15:00:12.285 Info Server: Session 1: Authentication for 'tester' succeeded.
15:00:12.289 Debug SSH: Session 1: Authenticated as 'tester' for 'ssh-connection'.
15:00:12.298 Debug SSH: Session 1: Received SSH_MSG_CHANNEL_REQUEST: subsystem('sftp').
15:00:12.303 Debug Server: Session 1: Starting acv(1) subsystem.
15:00:12.314 Debug SFTP: Getting item info on '/': success.
15:00:12.338 Debug SFTP: Opening file '/example.txt' (Create, Write): success.
15:00:12.344 Debug SFTP: Closing file '/example.txt': success.
15:00:12.353 Info Server: Session 1: Closed connection from 10.0.0.42:52404.
15:00:12.356 Info SSH: Session 1: Connection close requested.