2 Replies Latest reply on Jun 1, 2011 4:16 PM by Val Sw

    FileUpload tempfile delete when?

    Marco Röösli Newbie

      if I use:

      <component class="org.jboss.seam.web.MultipartFilter">
        <property name="createTempFiles">true</property>
        <property name="maxRequestSize">1000000</property>

      it will create tempFiles but when will this filed be removed? Is that depending on the session? or on the operating system how it handle temp files?

      Thx for your help

      Greetz Marco

        • 1. Re: FileUpload tempfile delete when?
          Vinícius Fernandes Newbie

          I wanna know this too. More than each, I don't know where is the tempfile.

          • 2. Re: FileUpload tempfile delete when?
            Val Sw Expert
            I think you need to delete it after your processing is done... item.getFile() will give you the complete file name

            Here is sample which I have used some time back...check where deleteTempFile(File f) is called..

            Let me know if this helps..

            public void listener(UploadEvent event) throws Exception{         
                    UploadItem item = event.getUploadItem();
                    file = new FileUpload();
                    //Add Content type
                    String fileType;
                    int extDot = item.getFileName().lastIndexOf('.');
                      if(extDot > 0){
                           String extension = item.getFileName().substring(extDot +1);
                      if (item.isTempFile()) {

            private void deleteTempFile(File f) throws SecurityException{