示例#1
0
文件: upload.go 项目: f110/go-imghr
func Upload(path string, data []byte) (string, error) {
	err := idcf.Put(path, data, "image/png")
	if err != nil {
		return "", err
	}

	return "https://" + idcf.BucketName() + ".ds.jp-east.idcfcloud.com/" + path, nil
}
示例#2
0
文件: upload.go 项目: f110/go-imghr
func Exists(path string) (bool, string, error) {
	exist, err := idcf.Exists(path)
	if err != nil {
		return false, "", err
	}

	if exist {
		return true, "https://" + idcf.BucketName() + ".ds.jp-east.idcfcloud.com/" + path, nil
	}

	return false, "", nil
}