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 });
            }

你可能感兴趣的:(OSS,判断文件是否存在,.net)