download - Downloading an email attachment using java -


i doing mail application using javamail. every thing fine, when user downloading attachment, exact attachment (fine) .at same time 0 byte file creating in server same file name.

how stop creation of 0 byte files in server.

my code :-

attfile = new file(attname);   fileoutputstream fileoutput = new fileoutputstream(attfile);  inputstream = part.getinputstream();   bufferedoutputstream outs = new bufferedoutputstream(fileoutput);   byte b[] = new byte[part.getsize()];   is.read(b);   out = response.getoutputstream();   out.write(b); 

you have 2 different (unrelated afaict) output streams: outs (wrapping fileoutput) , out. outs , fileoutput not seem used create empty file.


Comments

Popular posts from this blog

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

c++ - Convert big endian to little endian when reading from a binary file -

openssl - Load PKCS#8 binary key into Ruby -