Unable to open the File after uploading the File as Byte Stream to salesforce SFDC

Hi ,

I am uploading a .msg file by converting it into Byte steam .

String_bytes = System.io.File.ReadAllBytes(“C:.… file path…\Filename.msg”)
Then
Byte_stream = Convert.ToBase64String(String_bytes)

Then uploading the steam using Salesforce service API (services/apexrest/ServiceAPI2_Attach) , which is apparently different from standard SFDC API.

After the file is uploaded to SFDC and download it try to read the file ,i am unable to open the file and seems to be corrupted . I even tried with a .jpg and faced the same issue . i tried with multiple content types and still the issue could not be fixed .

binary
application/vnd.ms-outlook
application/octet-stream
multipart/form-data - which was not supported
application/json

and the uploaded file size is at least 15-20% larger than the original .

Please let me know if anyone has faced this issue or have any insights .

@benjamin.9052

check with the api team on how the file si needed as an attachment or a base64 string or in binary format?

cheers

I did reach out to the SFDC team , they say it accepts Binary .

So trying to figure out if there is any encoding issue .

@benjamin.9052

please check

cheers