what is wrong with this binary file transfer (corrupting docx files)?

女生的网名这么多〃 提交于 2019-12-02 00:34:08

Here is what I tried to do with your docx:

  • I opened them with word, the corrupted one was indeed corrupt
  • I unzipped the files, they were fully identical

I watched at the size of the docx, it was different for the docx.

So I looked into the binary file: The beginning of the file is identical

504b 0304 1400 0600 0800 0000 2100 ddfc
9537 6601 0000 2005 0000 1300 0802 5b43
6f6e 7465 6e74 5f54 7970 6573 5d2e 786d
6c20 a204 0228 a000 0200 0000 0000 0000

But at then end:

Uncorrupted file

6f72 642f 7374 796c 6573 2e78 6d6c 504b
0506 0000 0000 0b00 0b00 c102 0000 ed24
0000 0000 

Corrupted file

6f72 642f 7374 796c 6573 2e78 6d6c 504b
0506 0000 0000 0b00 0b00 c102 0000 ed24
0000 0000 0a2d 2d2d 2d2d 2d2d 2d2d 

As you can see, they is a sequence: 0a2d 2d2d 2d2d 2d2d 2d2d. The rest of the file is identical. And when I delete this sequence, the file is not corrupted any more.

Converted into ascii, 0a2d 2d2d 2d2d 2d2d 2d2d is \n----

This is probably due to the strRequestEnd = vbCrLf & "--" & strBoundary & "--"

Howewer, as I don't really understand exactly what happens into your code, If you want more help, please explain more deeply this portion of code.

Hope this helps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!