So I am passing a file upload data through a form POST to a PREVIEW pdf. It used to work, but we recently changed to PHP 8 and I haven't managed to adapt it.
Here is the code block that gets the the file upload data and converts it to a bit64 in order to display it.
$imageName = $_FILES['image']['tmp_name'];
if (!empty($imageName)) {
$str = file_get_contents($imageName);
$b64img = base64_encode($str);
$imagePath = 'data:image/png;base64,' . $b64img;
}
The Way the image is being passed through is with a form POST method.
<input type="submit" id="previewbtn" name="previewbtn" class="center-block"
style="width:100%; background-color:white" value="Preview"
formmethod="post"
formaction="/incidents/incidentResult.pdf.php?PREVIEW" />
If more information is needed, let me know.


I seem to have changed code and never adapted this section. The if exists is out of syntax. I just commented it out and it seems to be working now. Thanks to all who helped me.