All file开发者_如何学JAVAs that are on my IIS intranet, when downloaded become corrupted. If I open them on the server they are OK. If I copy them locally on my PC (transferring the file by File Explorer) they are OK. But if I create an Intranet page with a link on them and then I download them using my browser, when they arrive on my PC they are slightly larger and corrupted. It seems like IIS is corrupting them during the file transfer.
Thanks
Are you calling binmode on your output file handles? If you don't set the output streams to binary mode then plain newlines (\n
or more accurately \x0a
) will be converted to Windows-style CR-LF (\x0d\x0a
), that conversion would explain the size increase and the corruption.
Have you checked that the files you are trying to download, are supported MIME-Types in IIS? If the MIME-types aren't set, you can add them fairly easily in IIS.
精彩评论