problem
- upload image via
<input>
- inject that file into
<img src="">
-
src
url is blob url - when i try to copy this
src: blobUrl
into another<img src="">
tag, it throwsfile not found error
bc the image is not saved in server.
solution
- when upload the image, use
FileReader()
API - convert the uploading-image into base64 string with
readAsDataURL()
- inject that base64string into
<img src="">
- now you can take that
src
to any other<img src="">
tags
Top comments (0)