Try this, that's what I was using before I start using Apace-Commons
FileUploader:
==================
public class FileUpload extends HttpServlet{
public void doPost(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
ServletFileUpload upload = new ServletFileUpload();
try{
FileItemIterator iter = upload.getItemIterator(request);
while (iter.hasNext()) {
FileItemStream item = iter.next();
String name = item.getFieldName();
InputStream stream = item.openStream();
// Process the input stream
ByteArrayOutputStream out = new ByteArrayOutputStream
();
int len;
byte[] buffer = new byte[8192];
while ((len = stream.read(buffer, 0, buffer.length)) !
= -1) {
out.write(buffer, 0, len);
}
//.......
}
}
catch(Exception e){
e.printStackTrace();
}
}
}
=======================================
Be careful with large files.
What kind of problem did you have with Apache-Commons FileUploader?
That library is very simple and reliable.
On Jul 17, 12:04 pm, Petein <[email protected]> wrote:
> thanks for answering. i tried using the apache-commons fileupload but
> couldnt make that work. so i decided to implement it on my own. DO you
> have any sample code which works?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---