Send image between javascript pages

Asked

Viewed 55 times

0

I have an image that was uploaded by the user and I need to send it to another page to display on the screen before sending to the database.

Any suggestions on how to do this?

  • Play the image to a folder and recover from the other page

  • If it was uploaded to a folder on your correct server? Dai has several ways to show on the other page. If you access another page through link send the name on the link and on the other page recover it and put in the image src. If not, store this name in cookie or sessionStorage or localStorage and retrieve it on the other page

1 answer

1

Suggestion, you can save this image (stream) in one of the Webstores, so you will have quick and easy access.

You can use localStorage: (https://www.w3schools.com/html/html5_webstorage.asp)

to save the image stream:

localStorage.setItem('NAME','IMG_STREAM');

to catch the stream:

localStorage.getItem('NAME');

You can follow the values of the storages in the 'Application' tab in the browser development tool:

inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.