This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Hi All I was trying to upload a file using the com.oreilly package from www.servlets.com.I have an html form which accepts from the user the directory he/she wants to save the file on the server.Now when I send the request to the servlet how can I retrieve the parameter for the directory.I am using this constructor
If I correctly understand what you are trying to do..... You have a form that looks something like this: <form action="<%= fileServletURL %>" method="post" enctype="multipart/form-data"> <td height="50" width="150"><b> File:</b></td> <input type="file" name="attachment"> <br> <input type="text" name="path" value=""> <input type="submit" value=" Submit "> </form> This creates a MIME document with multiple "parts" -- each part is like an attachment. You have to create a Multi part Object that represents the encoded POST data. (I think you may have to use the MulitiPartParser (it has changed since I used it)) and use the readNextPart() method. You then go through the parts, looking for you parameter. It cannot be read directly with a request.getParameter(parameter) method, because it is encoded. I think that constructor is simply a way to specify where to put the file, if you want to load a destination from a resource bundle, or DB or something, I dont see how it can be used if you have to get the value from the request. James