Home  >  Q&A  >  body text

java - 异步上传图片无法即时回显

我用ajax+struts2将文件上传到了项目下的指定路径,在不刷新页面的情况下无法正常显示图片,有什么解决办法吗?求大佬指点。

阿神阿神2718 days ago464

reply all(3)I'll reply

  • PHP中文网

    PHP中文网2017-04-18 10:55:11

    Just check this in the workspace

    reply
    0
  • 迷茫

    迷茫2017-04-18 10:55:11

    It is best to rename the image path saved on the server, otherwise there will be caching problems.
    After ajax uploads the image, the server generates the path name and returns it to the front desk. The front desk then sets a new image path.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-18 10:55:11

    The image saved to the server needs to have a unique name, then return the full path of the image to ajax, and then modify the attributes that need to be echoed

    You can use the returned path to try it directly in the browser. If it works in the browser, then the page will also work

    reply
    0
  • Cancelreply