I make an applet,and use "FileDialog" class to choose a file and send its path to my servlet.When a client choose a file and sent its path to my servlet,why does my servlet search his file at my computer but not at his computer? What shall I do? Should I get the URL of his file?
hi When the file path reaches the servlet, for the servlet this path is relative to the servlet directory or the root directory in the same system.The servlet cannot access the client's system.So you cannot make the servlet read any client's file on its own. However you have two ways: 1. Make the applet trusted(by third party) so that it can read any client's file directly and send the contents to the servlet. For the servlet the file content will simply be a data stream sent by the applet. 2. Use the HTML file upload: <INPUT TYPE=FILE> to upload the file to the servlet.For this you might want to read a good book: Java Servlet Programming-OReilly. hope this helps Tanveer
Author of JPhotoBrush Pro (www.jphotobrushpro.com)
posted 18 years ago
Hi Thanks for your answer.Could you tell me how to make the applet trusted in details?
Make yourself as serene as a flower, as a tree. And on wednesdays, as serene as this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!