tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kham Mulman <kmul...@gmail.com>
Subject Re: providing downloading functionality for a file which is on disk
Date Tue, 21 Jul 2009 06:05:59 GMT
you can.

for instance,

File file = new File("C:\\temp\\downloadfilename.csv");
FileInputStream fileIn = new FileInputStream(file);
ServletOutputStream out = response.getOutputStream();

byte[] outputByte = new byte[4096];
//copy binary contect to output stream
while(fileIn.read(outputByte, 0, 4096) != -1)
{
	out.write(outputByte, 0, 4096);
}
fileIn.close();





On Tue, Jul 21, 2009 at 2:54 PM, Ritesh399 <ritesh399@gmail.com> wrote:

>
> Hi all
> I am developing a web application using jsp and want to provide some links
> for a user to download data. The data is not in web application's
> directory(somewhere else on disk)
> Can I provide a direct link to that data file ?
>
>
>
> Thanks
> Ritesh
> --
> View this message in context:
> http://www.nabble.com/providing-downloading-functionality-for-a-file-which-is-on-disk-tp24582115p24582115.html
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message