电子邮件附件最终为 0,0 kb
我正在制作一个电子邮件功能,所有功能都在本地发挥作用。 但是当我把它带到网络服务器时,电子邮件附件是 0,0kb.. 我认为它与流有关,但我没有收到任何错误消息,所以很难说。 我无法在我的服务器上使用流? 代码如下:
If FileUpload1.HasFile = True Then
Dim tempFileName As String() = FileUpload1.PostedFile.FileName.Split("\"c)
Dim emailAttach As New Attachment(FileUpload1.PostedFile.InputStream, tempFileName(tempFileName.Length - 1))
message.Attachments.Add(emailAttach)
emailAttach.Dispose()
End If
尝试了几件事,但无法找出出现问题的原因
Im making an emailng function and all works like a charm LOCALLY.
But when i take it to the webserver the email attatchment is 0,0kb.. i figured it has something to do with the stream but i doesnt get any error-messages so its hard to tell.
I cant use the stream on my server?
Heres the code:
If FileUpload1.HasFile = True Then
Dim tempFileName As String() = FileUpload1.PostedFile.FileName.Split("\"c)
Dim emailAttach As New Attachment(FileUpload1.PostedFile.InputStream, tempFileName(tempFileName.Length - 1))
message.Attachments.Add(emailAttach)
emailAttach.Dispose()
End If
Tried several things but cant find out why there is a problem
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请尝试以下操作:
备注:
PostedFile.InputStream
的别名)。另外,问题可能是因为您调用了 Dispose 方法(根据 Reflector)关闭输入流。
Try the following:
Remarks:
FileUpload
control (although it seems that it's just an alias toPostedFile.InputStream
).Also the problem might be because you make a call to Dispose method which (according to Reflector) closes the input stream.