# How do I upload an image to a canister?

**URL:** <https://forum.dfinity.org/t/how-do-i-upload-an-image-to-a-canister/9137>\
**Category:** Programs & Applications\
**Created:** [November 28, 2021, 5:29am UTC](https://forum.dfinity.org/t/how-do-i-upload-an-image-to-a-canister/9137 "2021-11-28T05:29:10Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Krktdev](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/krktdev/32/3817_2.png) [@Krktdev](https://forum.dfinity.org/u/Krktdev)\
**Post date:** [November 28, 2021, 5:29am UTC](https://forum.dfinity.org/t/how-do-i-upload-an-image-to-a-canister/9137/1 "2021-11-28T05:29:10Z")

</div>

I want the flow to be :  
A user uploads an image → It gets stored in a canister → A user can visit a url and see that image.

I do know about cancan but its a bit complicated.

---

<div class="post-metadata">

**Author:** ![jzxchiang](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jzxchiang/32/2592_2.png) [@jzxchiang](https://forum.dfinity.org/u/jzxchiang)\
**Post date:** [November 30, 2021, 5:40am UTC](https://forum.dfinity.org/t/how-do-i-upload-an-image-to-a-canister/9137/2 "2021-11-30T05:40:40Z")

</div>

Static images: use “asset” canisters (see the SDK quick start)  
User-generated images: chunk image blobs in the client and call custom canister methods with those blobs as arguments (see CanCan’s source)

---

<div class="post-metadata">

**Author:** ![Krktdev](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/krktdev/32/3817_2.png) [@Krktdev](https://forum.dfinity.org/u/Krktdev)\
**Post date:** [December 1, 2021, 8:13am UTC](https://forum.dfinity.org/t/how-do-i-upload-an-image-to-a-canister/9137/3 "2021-12-01T08:13:58Z")

</div>

@jzxchiang Where exactly should i look in cancans code

---

<div class="post-metadata">

**Author:** ![Jesse](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jesse/32/37836_2.png) [@Jesse](https://forum.dfinity.org/u/Jesse)\
**Post date:** [December 1, 2021, 3:04pm UTC](https://forum.dfinity.org/t/how-do-i-upload-an-image-to-a-canister/9137/4 "2021-12-01T15:04:33Z")

</div>

@anon74414410 another dev with the same question on uploading blobs. I think I’ve made my point so I’ll stop @'ing you on stuff now. My apologies again 😅

---

<div class="post-metadata">

**Author:** ![jzxchiang](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jzxchiang/32/2592_2.png) [@jzxchiang](https://forum.dfinity.org/u/jzxchiang)\
**Post date:** [December 2, 2021, 9:00pm UTC](https://forum.dfinity.org/t/how-do-i-upload-an-image-to-a-canister/9137/5 "2021-12-02T21:00:51Z")

</div>

Check this out: [File Storage On IC - #7 by jzxchiang](https://forum.dfinity.org/t/file-storage-on-ic/9207/7)

---

<div class="post-metadata">

**Author:** ![pattad](https://avatars.discourse-cdn.com/v4/letter/p/71c47a/32.png) [@pattad](https://forum.dfinity.org/u/pattad)\
**Post date:** [May 16, 2022, 3:42pm UTC](https://forum.dfinity.org/t/how-do-i-upload-an-image-to-a-canister/9137/6 "2022-05-16T15:42:33Z")

</div>

I just created another example here: [GitHub - pattad/imgTank](https://github.com/pattad/imgTank)

---

<div class="post-metadata">

**Author:** ![builder.icp](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/builder.icp/32/18247_2.png) [@builder.icp](https://forum.dfinity.org/u/builder.icp)\
**Post date:** [July 1, 2024, 10:00am UTC](https://forum.dfinity.org/t/how-do-i-upload-an-image-to-a-canister/9137/7 "2024-07-01T10:00:57Z")

</div>

Hi guys,  
I’m running into this - since I would like users of my app to upload images - and a lot of questions of popping up:

- What is the best architecture to support this: is it recommended to have a separate canister just for hosting the uploaded images ?
- Feels like most apps are going to need such a feature: is there any recent working guide/example of uploading images to a canister ? (I have a react + motoko app). @pattad Would you say you’re example is still up to date ? Are you still using it ?

Thanks !

---

<div class="post-metadata">

**Author:** ![pattad](https://avatars.discourse-cdn.com/v4/letter/p/71c47a/32.png) [@pattad](https://forum.dfinity.org/u/pattad)\
**Post date:** [July 2, 2024, 6:58am UTC](https://forum.dfinity.org/t/how-do-i-upload-an-image-to-a-canister/9137/8 "2024-07-02T06:58:27Z")

</div>

yes I’m still using it and its working. However, please check the latest Api documentation of Motoko to check its status.

---

<div class="post-metadata">

**Author:** ![builder.icp](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/builder.icp/32/18247_2.png) [@builder.icp](https://forum.dfinity.org/u/builder.icp)\
**Post date:** [July 3, 2024, 3:01pm UTC](https://forum.dfinity.org/t/how-do-i-upload-an-image-to-a-canister/9137/9 "2024-07-03T15:01:31Z")

</div>

In the end I simply stored images as a base64 string. It appears to work quite nicely, but I haven’t tried in production yet.  
Anyway, thanks for your help 🙂

---

<div class="post-metadata">

**Author:** ![taimoor\_dev](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/taimoor_dev/32/30432_2.png) [@taimoor\_dev](https://forum.dfinity.org/u/taimoor_dev)\
**Post date:** [September 11, 2025, 7:50pm UTC](https://forum.dfinity.org/t/how-do-i-upload-an-image-to-a-canister/9137/10 "2025-09-11T19:50:11Z")

</div>

If you’re going with base64, tools like [base64imageconverter.com](http://base64imageconverter.com) make it easy to test and prepare images before storing them in a canister.
