Curl upload fails and registers file

I am using curl to upload to nextcloud provided by my work. If the upload gets terminated mid-way, I find that the file still gets registered with the full filesize, even though only a fraction of the file uploaded. So the metadata must be being uploaded before the upload completes, which seems like a design floor. Is there something that can be done on the server by my company to fix this?

Well, the problem will be that not the whole file is uploaded. The clients usually catch these issues, show errors and then perhaps try to upload again.
I’d try to use some client based on webdav that handles a few things and gives you errors, or you need to implement something in your script with curl. There is also a python library: https://pypi.org/project/pyocclient/

I am not sure how the server handles incomplete uploads, if they can be detected and the file size be adjusted / user be warned etc.