java - How to directly download a file from server,without saving it in any folder? -


if(!ermutil.isnull(listofactualfilepaths) && listofactualfilepaths.size()>0){     fileoutputstream fos = new fileoutputstream("/smiles/wrk/attachments/ermweb/taxation/testing.zip");     zipoutputstream zos = new zipoutputstream(fos);      iterator itronfnames = listofactualfilepaths.iterator();     while (itronfnames.hasnext()) {         stringbuffer actualpath = (stringbuffer) itronfnames.next();         addtozipfile(actualpath.tostring(), zos);     }     zos.close();//closing both streams     fos.close(); }  public  void addtozipfile(string filename, zipoutputstream zos) throws filenotfoundexception, ioexception {     system.out.println("writing '" + filename + "' zip file");     file file = new file(filename);     int index = filename.lastindexof("/");     string filenameforzip =  filename.substring(index+1);     fileinputstream fis = new fileinputstream(file);     zipentry zipentry = new zipentry(filenameforzip);     zos.putnextentry(zipentry);      byte[] bytes = new byte[1024];     int length;     while ((length = fis.read(bytes)) >= 0) {         zos.write(bytes, 0, length);     }     zos.closeentry();     fis.close(); } 

i using above code, save zip-ed file on specific location. want that, instead of saving file, downloaded directly.

edit 1 see if want download zip file,then according above code, on path /smiles/wrk/attachments/ermweb/taxation/testing.zip saved first,then folder, i(server) can send client(computer).

but don't want save on specified path,instead of "saving first folder , sending client", directly want send client.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -