且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在jsp页面上显示上传的图像

更新时间:2023-10-25 12:35:22

您可能需要确保通过使用的Web服务器可以访问要上传图像的文件夹,这意味着它们的位置都在映射到Web服务器上的某些内容,并且Web服务器有权在创建图像文件后读取它们.

You likely need to make sure that the folder that you are uploading the images is accessible through the web server your are using, this would mean both that it's location is mapped to something on the web server and also that the web server has permission to read the image files after they have been created.

首先,我要确保文件确实显示在您期望它们所在的文件夹中,并且没有被某些东西清除.

I would start by looking to make sure that the files are actually showing up in the folder that you expect them to be in, and that they aren't being cleared out by something.

第二,检查是否可以手动将图像放置在该文件夹中,如果可以导航到图像的URL.如果不能,则可能是未映射或存在权限问题.

Second, check if you manually place an image in that folder if you can navigate to the url of the image. If you can't it likely isn't mapped or there is a permissions issue.

您可以测试图像的URL是否正常工作.不仅可以通过img标签检查它,还可以直接导航到URL并查看是否出现某种错误,这可以帮助您解决问题.

You can test to see if the URLs of the images are working. Instead of just checking it through an img tag, navigate to the URL directly and see if you get some kind of an error, this might help you troubleshoot the issue.