![]() The client will then display a dialog asking the user what directory that response should be written into as a file. A file download is just an HTTP response data stream that has certain characteristics designed to alert the client to the need to save the response contents as a file instead of doing something like displaying it as a web page. You cannot return multiple responses from a single request, and you DEFINITELY cannot have your server select a directory on the client computer's disk drive and write a file into it. You send 1 request, which is a URL GET, POST, or whatever, and the server returns 1 response, which can be a "file", a web page, or whatever. TODO iterate through string array,and get the file paths.ĪddFile( outZip, new File("C:\\TEMP\\sample3.mp3"), "temp.mp3" ) ĪddFile( outZip, new File("C:\\TEMP\\sample3.mp3"), "temp1.mp3" ) Įxpanding on on Paul's explanation, HTTP is a 1-to-1 request/response protocol. ![]() ZipOutputStream outZip = new ZipOutputStream( response.getOutputStream() ) get a ZipOutputStream, so we can zip our files together Response.addHeader( "Content-Disposition", "attachment filename=myzipfile.zip" ) ![]() ![]() ![]() I need to download multiple files from my jsp,My jsp will receive a string array,and in that each array will have a filePath.I ggot the solution to download multiple files by Using ZipOutPutStream,But i don't want to Zip Them,I need to download them in a folder.In that folder i should have all the files.Ĭatch( IOException ex ) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |