This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Servlets and the fly likes Upload File through Servlet problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Upload File through Servlet problem" Watch "Upload File through Servlet problem" New topic
Author

Upload File through Servlet problem

Blaine Mincey
Greenhorn

Joined: Nov 28, 2000
Posts: 15
Hi all. My co-worker is experiencing a strange problem. He is trying to do a
'simple' file upload through a servlet. The following code does the trick
using Internet Explorer both http and https but on Netscape it only works
through http. Using https on Netscape it always cuts off the last several
bytes of the file making it corrupt. Does anyone have any ideas? Code
snippet follows.
Thanks in advance.
Blaine
StringBuffer sb = new StringBuffer();
ServletInputStream in = request.getInputStream();
int i = in.read();
while (i != -1)
{
sb.append((char)i);
i = in.read();
}
out.println(sb.toString());

 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Upload File through Servlet problem
 
It's not a secret anymore!