search

Home  >  Q&A  >  body text

How to achieve picture preview?

echo "<center>Your file has been uploaded. Upload image preview: </center><br><center><img src='$upfile'></center>"; I use this code, but the picture cannot be displayed

LinXYLinXY2068 days ago1167

reply all(3)I'll reply

  • 沧澜猛兽

    沧澜猛兽2019-04-08 09:13:22

    First, make sure the image has been uploaded to a file in the project, such as the Upload file.

    Secondly, make sure the $upfile image path is correct.

    You can print $ first upfile, for example, the print result is ./Upload/images/xx.png, and then directly <img src='./Upload/images/xx.png'>

    If the picture can be displayed, then print it yourself There is a problem with the code in a certain corner. If it cannot be displayed and Tu Qian did upload it, the image path is wrong

    reply
    0
  • 路边的小蚂蚁i

    路边的小蚂蚁i2019-04-07 22:46:44

    What is the variable value in the address in the picture tag? If you copy the variable value directly to the browser, you can see that the picture description address correctly points to the address where the picture is saved in the server. If not, it means the address is wrong. Yes

    reply
    0
  • Cancelreply