Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

file downloader for image downloading not upto the limit....

 
prasad guna
Ranch Hand
Posts: 46
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i create file downloader its downloading perfectely but not an upto the total length


please help me as soon....
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic