现在的位置: 首页 > 综合 > 正文

文件上传(C#代码)

2013年12月03日 ⁄ 综合 ⁄ 共 417字 ⁄ 字号 评论关闭
string filename = file.PostedFile.FileName;

    string shortname = System.IO.Path.GetFileName(filename); //短文件名

    if (filename != "")
    {
     string path = ConfigurationSettings.AppSettings["PathSOP"].ToString();

     this.file.PostedFile.SaveAs(Server.MapPath(path + shortname));

     m_SOPInfo.FileName = shortname;
     m_SOPInfo.FilePath = path + shortname;
    }
    else
    {
     m_SOPInfo.FileName = "";
     m_SOPInfo.FilePath = "";
    } 

 

【上篇】
【下篇】

抱歉!评论已关闭.