Looks like there are so many Answers already but the issue I faced was with double quotes. There is a difference in between:
“
and
"
Changing the 1 st double quote to the second worked for me, below is the sample curl:
curl -X PUT -u xxx:xxx -T test.txt "https://test.com/test/test.txt"