Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

raulmercadox's avatar

How to upload an image that is referenced in an img element

I have a view that is using javascript to take photos using the camera.

The photo image is stored into an img element using data uri.

Now I want to upload that image when clicking the submit button. How can I do that?

Thanks,

0 likes
2 replies
raulmercadox's avatar

What I've done is using javascript assign the value of the src attribute to an input type="hidden" element. Then when I submit the form, the value of that input goes to the server.

Thanks,

Please or to participate in this conversation.