Java Mailing List Archive

http://www.gg3721.com/

Home » users.tapestry »

T5 with swfuploader stream failure

Ronny L

2008-11-10

Replies: Find Java Web Hosting

Author LoginPost Reply

Hi all,

I'm trying to use SWFUploader into my Tapestry application. My app will have
a functionality which upload files > 100. AFAIK Tapestry-Uploader does not
support multiple uploading. I have problem when receiving stream/uploaded
files from SWF Uploader(or any other flash uploader) into Tapestry page/jsp,
everytime I read the stream it always return -1 even though it has content
length > 0. By the way, Tapestry-Uploader works perfect.

       HttpServletRequest request =
requestGlobals.getHTTPServletRequest();
       String contentType = request.getContentType();


       System.out.println("Upload result:<br>");
     
//System.out.println(getServletContext().getRealPath(request.getRequestURI()));
       if ((contentType != null) &&
(contentType.indexOf("multipart/form-data") >= 0)) {
          DataInputStream in = new
DataInputStream(request.getInputStream());
          int formDataLength = request.getContentLength();

          byte dataBytes[] = new byte[formDataLength];
          int byteRead = 0;
          int totalBytesRead = 0;
          while (totalBytesRead < formDataLength && totalBytesRead >=
0) {
            byteRead = in.read(dataBytes, totalBytesRead,
formDataLength); // byteRead always zero
            totalBytesRead += byteRead;
          }
     }

Regards,
Ronny
--
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 gg3721.com - Jax Systems, LLC, U.S.A.