Skip to content

Base64file uploading to cloudinary is not working #82

@bete7512

Description

@bete7512

`

func uploadImageToCloudinary(base64str, name string) (*uploader.UploadResult, error) {
cloudinaryURL := os.Getenv("CLOUDINARY_URL")
cloudinaryClient, err := cloudinary.NewFromURL(cloudinaryURL)
if err != nil {
return nil, err
}
formattedString := fmt.Sprintf("data:image/jpeg;base64,%s", base64str)

uploadParams := uploader.UploadParams{
	PublicID:       name,
	UseFilename:    true,
	UniqueFilename: true,
}

// Upload the Base64 encoded content
result, err := cloudinaryClient.Upload.Upload(context.Background(), formattedString, uploadParams)
if err != nil {
	return nil, err
}

return &result, nil

}

`

I tried to do like this and also I tried many but just not working

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions