0
4

1 回答 1

0

假设该fileupload文件夹位于您的 Web 应用程序的根目录中(例如 www.yoursite.com/project/fileupload),为什么不使用静态 href 呢?

<a href="/project/fileupload/zingo.pdf" target="_blank">Click here to View the File</a>

确保将文件上传到正确的目录:

String uploadDir = "/fileupload/"; // or "/~project/fileupload/"
String path = getServletContext().getRealPath(uploadDir);
于 2013-04-25T04:10:49.997 回答