/// <summary> /// upload file /// 上传文件 /// </summary> /// <param name="FilePath"></param> /// <param name="GridFSName"></param> /// <returns></returns> public String UploadFile(String FilePath, String GridFSName = "") { if (System.IO.File.Exists(FilePath) == false) { throw new Exception("file path not found"); } //数据库连接 if (_connectionConfig.IsAutoCloseConnection == false) { if (_database.CheckStatus() == false) { throw new Exception("databse connect not open"); } } if (_connectionConfig.IsAutoCloseConnection == true) { _database.Open(); } String s = _database.UploadFile(_databasename, FilePath, GridFSName); if (_connectionConfig.IsAutoCloseConnection == true) { _database.Close(); } return(s); }