Ask coding questions

← Back to all posts
I want to be able to upload images to my chatroom in the chat. How?
h
UnluckyFroggy (919)

I want to be able to upload images to my chatroom in the chat. The link to the chatroom is: https://froggy-chatroom.unluckyfroggy.repl.co/

Comments
hotnewtop
Baconman321 (1061)

You are going to need to use filereaders for uploading images from the user's computer. I have a great tutorial on it:
https://replit.com/talk/learn/FileReader-in-javascript-What-is-it-and-how-does-it-work/80307

I would recommend reading the file as a data URL. That way you can simply send it to the server to store (I also recommend making a file size limit) and use that data-url as the source of an <img> tag.

UnluckyFroggy (919)

Sorry I can't give you the code to view, it's a private repl and I don't want to share the code.