OSS判断文件是否存在

          try
            {

                 OssClient handleclient = new OssClient(m_endpoint, m_id, m_key);
                // 判断文件是否存在。filePath文件路径
                bool exist = handleclient.DoesObjectExist(m_bucketName,filePath);
                if (exist)
                    return Request.CreateResponse(new {Success=true });
                else
                    return Request.CreateResponse(new { Success = false,ErrMes="文件不存在" });

            }
            catch (Exception ex)
            {               
                return Request.CreateResponse(new { Success = false, ErrMes = "异常:"+ex.Message });
            }

猜你喜欢

转载自blog.csdn.net/cy520ta/article/details/85156345
今日推荐