| Author |
file downloader for image downloading not upto the limit....
|
prasad guna
Ranch Hand
Joined: Feb 12, 2009
Posts: 38
|
|
i create file downloader its downloading perfectely but not an upto the total length
please help me as soon....
|
Prasath.G
SCJP
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
Available Doesn't Do What You Think It Does.
Also some corrections to your code:
1) check if cat is null, or you will get into problems.
2) you can't use File with an http:// URL. Instead, you should use the following code: ServletContext's getRealPath method will translate the path, relative to your web application, to a real file path. In this case, it would be C:\<Path to Tomcat>\webapps\WebApplication1/image/<filename> on Windows.
3) don't mix response.getWriter() and response.getOutputStream(). Simply remove setting the first content type, and every reference to out.
4) your code is vulnerable to path injection. Suppose the filename is ..\..\..\..\..\..\..\..\..\..\Windows\win.ini - that could allow the user to retrieve C:\Windows\win.ini. With other examples, the user could retrieve important system files. Make sure that you validate the file name first.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: file downloader for image downloading not upto the limit....
|
|
|