I have a quite simple question which I have a hard time solving. People can upload files (images) to my site. I'd like to display the images to the visitors of the site, but I do not want to store the images in the document root, but outside of it.
Does anyone know how to accomplish such a task? Do I have to work with different RequestDispatchers, or is there some other way?
think about it. If a webserver could serve files from any location on the system it's running on that would be a massive security leak.
Many application servers won't even allow servlets (or PHP, CGI, whatever) to access any files outside their application scope without special settings in the server configuration for that very reason.
Joined: Sep 08, 2001
Jeroen, I agree with you, it could be a security hole, but this could maybe be prevented by the Security Manager or the file system.
Maybe you have a suggestion than how to handle file uploads and be able to present the upload files to other users?
Any help would be greatly appreciated, and thanks for your suggestions so far.
Joined: Oct 12, 2000
Do as bear suggested. A similar approach can work for uploading as well.