0

This may sound unusual, but is there a way to change the value/source of an input type File Upload element to upload an image that is already in the DOM?

so I have:

<img src="myimage.jpg"> <input type="file"> 

I would like a trigger so that the file upload is uploading myimage.jpg which is already in the DOM

0

1 Answer 1

1

No. You can't set the value of a file input (other than to blank it) at all.

You could set a hidden input to the image's URL (either its original URL or a data: scheme URL you generate with JS) and have your server-side code check for that as well as the file input value in the submitted form data.

Sign up to request clarification or add additional context in comments.

1 Comment

Actually you can...

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.