Hi there,
I understand that PHP is not the direction of this forum, but I am hoping to find some clues to solving my problem here.
I am using PHP to make a rest api call to sharepoint 2019, and it is working successfully for .pdf and .txt file types, but not .doc and .docx types. I am receiving errors such as:
"Word found unreadable content in {filename}.docx". Do you want to recover the contents of this document? If you trust the source of this document, click yes."
If I click yes it opens the file and it seems to work.
Below is a raw output of the request I am making. I think I am having issues with my file encoding, but am not sure what is required for .docx to successfully make it to the sharepoint server
POST {sharepointsite}/_api/web/lists/getbytitle('{documentlibary}')/rootfolder/files/add(url='{filename}.docx',overwrite=true)
HTTP/1.1
Host: {redacted}
Accept: application/json; odata=verbose
Cache-Control: no-cache
X-RequestDigest: {redacted}
Authorization: {redacted}
Connection: Keep-Alive
Request-Id: {redacted}
Content-Type: multipart/form-data; boundary=----------637571310612295910
Content-Length: 12184
------------637571310612295910
Content-Disposition: form-data; name="uploaded_file"; filename="{filename}.docx"
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
{body data}