1 Reply Latest reply on Apr 23, 2007 1:50 PM by christian.bauer

    Wiki question: File to db with minimal memory


      The wiki source (which btw I've found the wiki app source to be tremendously useful - thanks for doing this in the open) for FileHome.java has the following comment:

       // TODO: This should really use an InputStream and directly stream into the BLOB without consuming server memory
       private byte[] filedata;

      I've put off dealing efficiently with uploaded file data, and would like to lock this down as well.

      The two parts I see are 1) having file upload write directly to a tmp file, and never keeping a naked byte [] in memory, and 2) implementing what the above comment refers to.

      I can figure out #1 from Seam source (MultipartRequest seems pretty clear). Does anyone have any pointers for #2?

        • 1. Re: Wiki question: File to db with minimal memory

          Actually, what I wanted to do is stream the HTTP request directly into the BLOB field without ever consuming more memory than necessary for a small buffer. No temporary files, etc. The last time I've done this was many years ago with totally different technology. I actually never attempted this in Java although I'm sure it's possible. So I'm waiting for someone else to do the research :)