天天看點

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

            }

繼續閱讀