# File upload simple example

**URL:** <https://forum.dfinity.org/t/file-upload-simple-example/5996>\
**Category:** Developers\
**Created:** [July 19, 2021, 11:40pm UTC](https://forum.dfinity.org/t/file-upload-simple-example/5996 "2021-07-19T23:40:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ehsan6sha](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/ehsan6sha/32/2460_2.png) [@ehsan6sha](https://forum.dfinity.org/u/ehsan6sha)\
**Post date:** [July 19, 2021, 11:40pm UTC](https://forum.dfinity.org/t/file-upload-simple-example/5996/1 "2021-07-19T23:40:52Z")

</div>

Hi  
I am aware of Cancan, but does anyone has a very basic/simple example of file upload to start with?

---

<div class="post-metadata">

**Author:** ![anon74414410](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@anon74414410](https://forum.dfinity.org/u/anon74414410)\
**Post date:** [July 19, 2021, 11:48pm UTC](https://forum.dfinity.org/t/file-upload-simple-example/5996/2 "2021-07-19T23:48:18Z")

</div>

Oh, let me push mine

---

<div class="post-metadata">

**Author:** ![anon74414410](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@anon74414410](https://forum.dfinity.org/u/anon74414410)\
**Post date:** [July 19, 2021, 11:55pm UTC](https://forum.dfinity.org/t/file-upload-simple-example/5996/3 "2021-07-19T23:55:57Z")

</div>

> **[krpeacock/file\_upload\_experiment](https://github.com/krpeacock/file_upload_experiment)**
>
> testing repo taking advantage of asset canister functionality - krpeacock/file\_upload\_experiment

---

<div class="post-metadata">

**Author:** ![anon74414410](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@anon74414410](https://forum.dfinity.org/u/anon74414410)\
**Post date:** [July 19, 2021, 11:57pm UTC](https://forum.dfinity.org/t/file-upload-simple-example/5996/4 "2021-07-19T23:57:48Z")

</div>

it’s a few steps away from using a file input, and won’t support chunking, but it’s a proof of concept to authorize uploads to an asset canister, write a `foobar.txt` file, and then fetch it

---

<div class="post-metadata">

**Author:** ![jeshli](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jeshli/32/19879_2.png) [@jeshli](https://forum.dfinity.org/u/jeshli)\
**Post date:** [November 29, 2023, 9:52pm UTC](https://forum.dfinity.org/t/file-upload-simple-example/5996/5 "2023-11-29T21:52:42Z")

</div>

If I were to adapt this code to rust, would I just ignore the .did.d.ts and .did.js files and reorg the file structure a bit and adapt the .mo code to the appropriate lib.rs?

---

<div class="post-metadata">

**Author:** ![anon74414410](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@anon74414410](https://forum.dfinity.org/u/anon74414410)\
**Post date:** [November 29, 2023, 9:59pm UTC](https://forum.dfinity.org/t/file-upload-simple-example/5996/6 "2023-11-29T21:59:55Z")

</div>

This is such old code now - things should still work but this isn’t how I’d do anything today

---

<div class="post-metadata">

**Author:** ![jeshli](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jeshli/32/19879_2.png) [@jeshli](https://forum.dfinity.org/u/jeshli)\
**Post date:** [November 29, 2023, 10:02pm UTC](https://forum.dfinity.org/t/file-upload-simple-example/5996/7 "2023-11-29T22:02:38Z")

</div>

Great to know. I did see that it was quite old. I’m trying my best to figure out the asset loading we discussed using icx-asset and ic-certified-asset but am having several issues so I am looking for the simplest examples I can find related to uploading files.
