I understand how to create a form of type "multipart/form-data" that uploads a file from a client's box , but I am trying to use the same form code for downloading a file to a client's box .
Using the code below, the value of input named "downloadFileInput" should have "test.txt", but it is blank. If I try to use the "Browse" panel that pops up and provide it a file name of "test.txt", it returns a message that that file does not exist.
What is wrong with this HTML code within JSP file?
I don't understand. If you want to download a file from the server, you just copy the file to the response. There isn't any HTML required to do that, only a link to something which will return the file as its response.
And preferably you wouldn't use a JSP to do that, since JSP is meant to generate HTML. If you're returning a file rather than an HTML page, you should use a servlet to return the file.
Or were you thinking that via this form, you could tell the browser where to put the file, so that the user wouldn't have to answer that question? Nope. That would be a serious security violation.
jhon masco wrote: I suspect this is for hacking reasons
I suspect not, because that doesn't make any sense.
Ultimately I think the OP is looking for a way to select a file from the server for download. But it's kind of hard to say. But as mentioned, form submissions go from the client to the server--nothing to do with downloading.
What precisely are you looking for? How to navigate files on the server?
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: How to create an HTML form in JSP for downloading files?