imgbb upload image in an album via api

Viewed 1028

I have a trouble with using imgbb API via imgbb API i've been trying to upload an image to the album that i created on imgbb. but i couldn't find any of informations so far... (i've been googling for 3hours lol) anyone knows what to add for saving images in an album?

here are my codes.

thanks for reading :)

let body = new FormData()
body.set('key', 'my-api-key')
body.append('image', File)


axios.post('https://api.imgbb.com/1/upload/', body)
    .then((response) => {
        console.log('response', response)
        console.log('response URL', response.data.data.image.url)
        console.log('success')
    })
    .catch((error) => {
        console.log('error', error)
        alert('try agian')
    })  enter code here
1 Answers

From the doc

curl --location --request POST "https://api.imgbb.com/1/upload?expiration=600&key=YOUR_CLIENT_API_KEY" --form "image=R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"

try this

let payload = new FormData()
payload.append('image', File)


axios.post('https://api.imgbb.com/1/upload?expiration=600&key=YOUR_CLIENT_API_KEY', payload)
    .then((response) => {
        console.log('response', response)
        console.log('response URL', response.data.data.image.url)
        console.log('success')
    })
    .catch((error) => {
        console.log('error', error)
        alert('try agian')
    }) 
Related