I use this method [System.g开发者_如何学编程etProperty("user.home")
] in my grails application under groovy, to get the root directory and save a file in this directory, but when I deploy the website to the server and try this method the file saved in the server side not in the client one. It means that System.getProperty("user.home")
get the root directory of the server not of the client. What can I do to get the client root directory and not the server one.
You can't get the client's home directory. And you cannot automatically save files onto a remote clients machine in the folder of your choice.
When you are running it on your own computer and calling System.getProperty("user.home")
seems to work, it is only because you are browsing the site from the server as a local client.
As has been explained to you before in a previous question, you cannot automatically save a file to a location chosen by you on the client's machine.
Not without installing some sort of client software on their machine anyway, or by using a signed applet or similar signed technology.
This would be a huge security issue otherwise.
精彩评论