1

我的网络应用程序有问题。我已经为上传文件做了一个上传功能。本地调试它没有问题。当我在服务器上运行我的应用程序时,它也可以工作,但是文件在上传后损坏(例如,word 文件只有一些符号而不是正确的文本)。

我认为错误必须在服务器设置中的某个地方,或者可能在 webconfig 中?我从几个小时开始搜索解决方案,但找不到类似的问题(是的,也许我用错误的关键字搜索:(

有人有解决办法吗?谢谢!

我的代码:

<asp:FileUpload ID="FileUpload1" runat="server" /><br />
<asp:Button ID="btnUpload" runat="server" Text="Datei hochladen" onclick="btnUpload_Click" />

背后的代码

//some code for save fileinfos in database...
...
...

//Upload File
FileUpload1.SaveAs(path + fileName);

我没有可以发布的错误消息,因为它显然一切正常。问题是在服务器上上传后文件损坏(本地有效)

4

1 回答 1

1

I can't see the byte array generation code here(the section you have commented above) but if everything is ok in the code, the byte array received from stream is corrupted. It may be because of errors in client side java script codes. But you say that a local test is ok. It may be because of the network settings ?! If packet payloads are corrupted, what you get on server side will be corrupted as well. Do you have any firewall in the middle ?! Any signature matching application ?!

于 2012-06-04T14:45:02.793 回答