PHP Store Image in variable

1

Is it possible to store an image in a PHP variable (get it by "POST" method) and then use it to call the image in other places? Just like with strings coming from HTML input.

    
asked by anonymous 22.09.2017 / 18:55

1 answer

1

Create a input type="hidden" save the image path in the value, like this:

<input type="hidden" name="img" value="caminho_da_imagem" />

And if you want to use the site in the future, you can save it in a $_SESSION variable and use it like this:

<img src="<?=$_SESSION['img']; ?>" />

I hope this is what you want.

    
22.09.2017 / 19:14