Lhen
Lhen

Reputation: 181

image saved on local storage pass to input file

I have successfully stored a base64 image to the local storage.

I have tried and failed in adding the stored value to an input file field.

document.getElementsByName("inputfieldname")[0].setAttribute("value", getSavedValue("thesavedkey"));

<input type="file" name="inputfieldname">

Upvotes: 0

Views: 37

Answers (2)

Pyae Phyoe Shein
Pyae Phyoe Shein

Reputation: 13827

document.getElementById('mytext').value =  = window.sessionStorage.getItem('user')

try above one.

Upvotes: 1

Hank X
Hank X

Reputation: 2044

you can't set a value in this way to a file type input due to legacy security vulnerabilities.

Upvotes: 2

Related Questions