主要代码:

    public string FileUploadImage(string ImagefileName, byte[] byteFileStream)
    {
        string mess = "";
        try
        {
            string filePath = HttpContext.Current.Server.MapPath("UploadFile/" + ImagefileName);
            FileStream fs = new FileStream(filePath, FileMode.OpenOrCreate, FileAccess.Write);
            BinaryWriter w = new BinaryWriter(fs);
            w.Write(byteFileStream);
            w.Flush();
            fs.Close();
        }
        catch (Exception eX)
        {
            mess = eX.Message;
        }

        if (mess != "")
        {
            return mess;
        }
        else
        {
            return "从服务器返回的消息:恭喜!文件   " + ImagefileName + "已成功上传!   返回时间为" + System.DateTime.Now.ToLongTimeString();
        }
    }

 

相关文章:

  • 2021-09-22
  • 2021-05-25
  • 2021-07-07
  • 2022-12-23
  • 2021-10-31
  • 2022-01-05
  • 2021-12-02
  • 2022-01-05
猜你喜欢
  • 2022-12-23
  • 2021-05-29
  • 2021-12-02
  • 2021-09-20
  • 2022-12-23
  • 2022-02-27
  • 2021-06-25
相关资源
相似解决方案