Skip to content

(Binary) File Upload #42

@slimcdk

Description

@slimcdk

Hello

How to possibly upload files together with other data ?

type Payload struct {
  File *os.File `json:"file"`
  Field string `json:"field"`
}
file, err := os.Open("somefile.bin")
res, err := pocketbase.Create("files", Payload{
  File: file
  Field: "blabla"
})

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.

type Payload struct {
  File []byte `json:"file"`
  Field string `json:"field"`
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions