Skip to content

Instantly share code, notes, and snippets.

@thanhtungdp
Created April 3, 2020 02:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thanhtungdp/166890c58292d82942165eab711341ed to your computer and use it in GitHub Desktop.
Save thanhtungdp/166890c58292d82942165eab711341ed to your computer and use it in GitHub Desktop.
Upload Photo to Minio
const currentPrefix = "Giới thiệu/" //current folder
const fileName = "tung.jpg"
const prefix = path.join(currentPrefix, fileName)
const { data: { url }} = await api.get(`/s3/buckets/ilotusland/presigned-put-object?prefix=${prefix}`)
// `url` là API trả về, để từ Frontend PUT lên dữ liệu
const file = Object{} // file from select
api.put(url, file, {
headers: {
'Content-Type': file.type
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment