(ctx context.Context, key string, file []byte)
| 49 | } |
| 50 | |
| 51 | func (s *S3Service) UploadFileToR2(ctx context.Context, key string, file []byte) error { |
| 52 | input := &s3.PutObjectInput{ |
| 53 | Bucket: aws.String(s.bucket), |
| 54 | Key: aws.String(key), |
| 55 | Body: bytes.NewReader(file), |
| 56 | ContentType: aws.String("application/zip"), // Set the content type to application/zip for .zip files |
| 57 | } |
| 58 | |
| 59 | // Upload the file to Cloudflare R2 Storage |
| 60 | _, err := s.s3Client.PutObject(ctx, input) |
| 61 | if err != nil { |
| 62 | return err |
| 63 | } |
| 64 | |
| 65 | return nil |
| 66 | } |