uploadind服务器上的msg文件 [英] uploadind a msg file on a server
本文介绍了uploadind服务器上的msg文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的本地有一个temp.msg文件,我需要在服务器上传。
我是用以下代码做的,
I have a temp.msg file on my local which i need to upload on the server.
I do it using the following code,
if (UpldDelvMail.HasFile)
{
DelvMailName = UpldDelvMail.FileName;
bool isExists = Directory.Exists(Server.MapPath(SavePath));
if (!isExists)
{
Directory.CreateDirectory(Server.MapPath(SavePath));
}
UpldProDoc.SaveAs(Server.MapPath(SavePath + DelvMailName));
}
但它无法正常保存。
上传的temp.msg on服务器是空白的。
如何保存文件,然后使用我的网络应用程序再次打开它。
but It does not get saved properly.
The uploaded temp.msg on server is blank.
how can I save the file porperly and then open it again using my web application.
推荐答案
只需检查UpldProDoc.FileName是否为null。这是因为UpldProDoc没有上传文件。检查以下代码
Just check that UpldProDoc.FileName is not null. This is happening as UpldProDoc got no uploaded file. Check below code
if (UpldDelvMail.HasFile && UpldProDoc.FileName != "")
{
DelvMailName = UpldDelvMail.FileName;
bool isExists = Directory.Exists(Server.MapPath(SavePath));
if (!isExists)
{
Directory.CreateDirectory(Server.MapPath(SavePath));
}
UpldProDoc.SaveAs(Server.MapPath(SavePath + DelvMailName));
}
这篇关于uploadind服务器上的msg文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文