package file

import (
	"io"
	"mime/multipart"
	"os"
)

// SaveFile simpan file ke local storage (tanpa fiber)
func SaveFile(file *multipart.FileHeader, path string) error {
	src, err := file.Open()
	if err != nil {
		return err
	}
	defer src.Close()

	dst, err := os.Create(path)
	if err != nil {
		return err
	}
	defer dst.Close()

	_, err = io.Copy(dst, src)
	return err
}