how to get full path from file type in JSP?

i written some code in JSP like this--

<input type="file" name="imagename" >

and in servlet i am retrieving 'imagename' value. But it is giving the name of the image instead of full path. My servlet code is like this:

String imagename = request.getParameter("imagename");

and i dont want to use javascript. any ideas? Thanks in advance

Answers


Maybe you should checkout this question: How to get the file path from HTML input form in Firefox 3

There is little to no reason why server should have to know full file path. If you want to upload a file, you'll need to use an appropriate library like Apache Commons FileUpload and transfer the file using.

<form action="upload-script-url" method="post" enctype="multipart/form-data">
  <input type="file" name="file">
  <input type="submit">
</form>

Apache Commons FileUpload will then accept and transform encoded file into a usable form.

Otherwise you'll need to use JavaScript to get that path.


Need Your Help

Socket.IO: Are Emits from clients to the server private

node.js socket.io client server privacy

So here is the deal; I have a Client, that needs to send a message to the server, and that message needs to be private. My question is, when I emit something from a client, can other clients see the

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.