PHP Store Image in variable

Asked

Viewed 923 times

1

Is it possible to store an image in a PHP variable (take it by "POST" method) and then use it to call the image elsewhere? Just like it is done with Strings coming from HTML input.

  • 1

    What is this image? A file sent through input file? Can you save the disk image to the server and store only its path in the variable? And what "other places" would these be?

  • @Andersoncarloswoss, I think he wants to record in the bank, and then request with a same URL

  • Actually it was to save in a variable even, the file comes from an input of type file in a form, all the information comes from the form for PHP and ai Gero a PDF, I wanted to know if it could do this with the image that comes from the upload so that it appears in the PDF.

1 answer

1


Create a input type="hidden" keep the image path in value, so:

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

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

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

I hope this is what you want.

Browser other questions tagged

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