Open slimcdk opened 1 year ago
Thanks for this issue; this is a great question; the binary upload was not tested and developed with current releases. I need to rethink this problem and maybe introduce the Upload(id, []byte)
method.
Would it work if we introduce a new method to create/update records with files, and avoid breaking API backwards compatibility?
_, err := client.CreateWithFiles(
"bookmarks", // Collection name
map[string]string{
"title": "something",
"url": "http://foo.bar",
}, // form data
map[string]string{"snapshot": v["path-to-local-file"]} // files to upload. `snapshot` is pocketbase collection file column name
)
I've been using that approach successfully in https://github.com/rubiojr/pocketbase-go/commit/666da01d379c024e24899b4f37c5d3aae0a7dbbf. Something similar could be done with updates.
Hello
How to possibly upload files together with other data ?
Resty either takes in file as raw bytes or parses them separately https://github.com/go-resty/resty#multipart-files-upload. Sending files a raw bytes doesn't work either.