Base64file uploading to cloudinary is not working

Open
#82 2 comments 0 reactions 0 assignees View on GitHub

@AnshShah77 is already working on this.

Since Oct 6, 2023.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
go
Domain
cloud

Research direction

Start by reproducing the uploadImageToCloudinary function with the supplied Base64 content and inspect the error returned by cloudinaryClient.Upload.Upload. Determine why this upload does not succeed; done means the Base64 image uploads successfully and returns a valid UploadResult.

Written by the indexing model from the issue text.

Description

`

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

Dominant language
Go
Stars
51
Forks
25
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cloudinary/cloudinary-go

All issues in cloudinary/cloudinary-go

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.