Products Resources Support About Us

cURL PUT with --data-binary from z/Os


I am attempting to PUT a z/OS load module on a Linux system into a repository to be pulled later and run on z/OS. I am using
curl -X PUT -k -u userid:passowrd
-v -T --data-binary @/folder/

I get an error “curl: Can’t open ‘–data-binary’!”. Is this not a valid option on PUT? I see people asking questions about cURL POST with --data-binary but not PUT.

Any suggestions on how to put a file in binary from cURL? I do it all the time FTP but what I am putting this do does not support FTP.

Thank you



If you use -T or --upload-file option, PUT will be use by default for HTTPS.
–data-binary is using for POST requests but it can be changed to PUT:
If you want to upload file on FTP or HTTP server, you need to run:
curl -u userid:password -v -T /folder/ “ftp://dnsname/path/filename”
curl -k -u userid:password -v -T /folder/ “https://dnsname/path/filename”
curl -k -u userid:password --data-binary “@/folder/” -X PUT “https://dnsname/path/filename”

The binary transfer mode is default for curl if you are using -T(–upload-file) option.
But there is an another problem - a bug connected with binary mode. The uploaded file can be coverted to another encoding.
Unfortunately, this bug is not fixed yet.



Hi Sergey and thank you for the response.

I am using the -T on my PUT request.

The product I am doing the upload to Artifactory does not support FTP or I would be using that, with or without cURL.

What are the results of the -a bug connected with binary mode? I am attempting to determine when this EBCDIC file is being converted to ASCII.




Hi Kevin.

Just my 2ct.
I got a similar problem and over here I had to change the @ to § because of Codepage mismatch.

regards michael


Thank you I saw that in another thread you posted. It was the first thing I tried. I am using a heavy handed work around now. I use FTP bin to put my load modules on a Unix FTP server then a cURL POST from the mainframe that kicks off a script to get it to its build destination. It works and keeps it all in EBCDIC format.