I've created a program that upload PDF files from a server.
I save the uploaded file to
getServletContext().getRealPath("/")+ "UploadedFiles\\";
Also I created a File Viewer to display the names of all uploaded files..
Now all I have to do is display the PDF file to browser.
My problem is the when I get the
getServletContext().getRealPath("/")+ "UploadedFiles\\";
this is the value
D:\Java\Java Web Projects\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\PDFviewer\UploadedFiles\version.pdf
The path is not in my project location. Well I'm hoping I can do this to diplay the file
http://localhost:8080/PDFviewer/UploadedFiles/version.pdf
Can anybody give me an idea of displaying a PDF file?
My project location is
D:\Java\Java Web Projects\PDFviewer
REVISION:
Is there a way to get the Project Path
D:\Java\Java Web Projects\PDFviewer\WebContent\UploadedFiles\
instead of this
getServletContext().getRealPath("/")+ "UploadedFiles\\";
D:\Java\Java Web Projects\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\PDFviewer\UploadedFiles\version.pdf
NOTE:
I can't do this
C:\sample.pdf
because I'm also running my web site to a client side computer, not in the server...