You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: put_object_handler.go
    path of file: ./repos/wal-g/internal/storagetools
    
    the code of the file until where you have to start completion: package storagetools

import (
	"context"
	"fmt"
	"io"
	"os"
	"path/filepath"

	"github.com/wal-g/wal-g/internal/compression"
	"github.com/wal-g/wal-g/internal/crypto"

	"github.com/wal-g/wal-g/utility"

	"github.com/wal-g/wal-g/internal"
)

func HandlePutObject(
	ctx context.Context,
	source io.Reade
    
func uploadFile(ctx context.Context, name string, content io.Reader, uploader internal.Uploader, encrypt, compress bool) error {
	var crypter crypto.Crypter
	if encrypt {
		crypter = internal.ConfigureCrypter()
	}

	var compressor compression.Compressor
	if compress && uploader.Compression() != nil {
		compressor = uploader.Compression()
		name += "." + uploader.Compression().FileExtension()
	}

	uploadContents := internal.CompressAndEncrypt(content, compressor, crypter)
	return uploader.Upload(ctx, name, uploadContents)
}