Page 1 of 1

SOLVE:Multiple Fileupload not process 13 or + images PF 5.1.

Posted: 30 Jan 2015, 23:34
by scarsix06d
Hi all.

I have the next problem. I try to upload 20 images at the same time.

1. The normal uploader
Image

2. Select 20 images at the same time
Image

3. The upload component shows all images and here is all fine
Image

4. Make click on upload button for loading all images and in this part I put a debug point for breaking the upload and can validate what happen, so now I can see that the browser send 20 POST request. Here is all OK
Image

5. Now, after processing the first POST request entry once at the method but process two POST lines, finally only load 12 images
Image

6. Only load 12 images
Image

So, it's the issue. I try in tomcat 7.57, Jetty 7, tomcat 8.018 using mojarra 2.011 and 2.28 but no, not work.

I let the code

xhtml

Code: Select all

<p:fileUpload style="width:100%" fileUploadListener="#{propertyBean.handleFileUpload}" auto="false" multiple="true" fileLimit="20" immediate="true" mode="advanced" previewWidth="60" dragDropSupport="true" sizeLimit="10000000"  update="uploadedImage uploadedImageListError @this" process="@all" allowTypes="/(\.|\/)(gif|jpe?g|png)$/" onstart="PF('statusDialog').show()" oncomplete="PF('statusDialog').hide();" />
java

Code: Select all

@Synchronized
	public void handleFileUpload(FileUploadEvent event) {
		try {
			if (event != null) {
				BufferedImage baseImage = ImageIO.read(event.getFile().getInputstream());
				int w = baseImage.getWidth();
				int h = baseImage.getHeight();

				boolean error = false;

				if (w < 200) {
					error = true;
				}

				if (h < 200) {
					error = true; 
				}

				this.propertyFile = event.getFile();

				this.fileName = null;
				String fileTmpName = event.getFile().getFileName();
				String extensionFile = fileTmpName.substring(fileTmpName.lastIndexOf("."), fileTmpName.length());

				this.fileName = loadRandomName();
				this.fileName += extensionFile;
				
				if (!error) {
					if (propertyFileList.size() > 0) {
						counter = propertyFileList.size() + 1;
					} else {
						counter = 0;
						counter++;
					}
				}

				InputStream is = addWaterMarkTofile(event.getFile().getInputstream(), generalPath);
				if (!error) {
					propertyFileList.add(new PropertyFileUtil(fileName, event.getFile(), counter));
					propertyFileListCpy.add(new PropertyFileUtil(fileName, event.getFile(), counter));
				} else {
					propertyFileListError.add(new PropertyFileUtil(fileName, event.getFile(), counter));
				}

				log.info("file move to " + generalPath + PROPERTY_TMP_PATH + fileName);
				FileUploadManager.uploadFile(is, generalPath + PROPERTY_TMP_PATH, fileName);
			}
		} catch (Exception e) {
			ErrorNotificacion.handleErrorMailNotification(e, this);
		}
	}
web.xml

Code: Select all

 
<context-param>
  <param-name>primefaces.UPLOADER</param-name>
  <param-value>commons</param-value>
 </context-param>

<listener>
  <listener-class>org.apache.commons.fileupload.servlet.FileCleanerCleanup</listener-class>
 </listener>

 <filter>
  <filter-name>PrimeFaces FileUpload Filter</filter-name>
  <filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
  <init-param>
   <param-name>thresholdSize</param-name>
   <param-value>25000</param-value>
  </init-param>
  <init-param>
   <param-name>uploadDirectory</param-name>
   <param-value>C:/opt/tucasa/temp</param-value>
  </init-param>
 </filter>

<filter-mapping>
  <filter-name>PrimeFaces FileUpload Filter</filter-name>
  <servlet-name>Faces Servlet</servlet-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>
 <filter-mapping>

Thanks in advance

PF: 5.1.19
Server: Tomcat 7.57
PFE: 3.0
Omnifaces: 1.8.1
Prettyfaces: 2.2.3
Mojarra: 2.28

SOLVE Multiple Fileupload not process 13 or more images PF 5

Posted: 15 Apr 2015, 20:21
by scarsix06d
After long testing

The issue was caused by the next params.

I deleted this params and works

Code: Select all

  <context-param>
  <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
  <param-value>true</param-value>
 </context-param>
 <context-param>
  <param-name>com.sun.faces.enableRestoreView11Compatibility</param-name>
  <param-value>true</param-value>
 </context-param>
 

Re: SOLVE:Multiple Fileupload not process 13 or + images PF

Posted: 15 Apr 2015, 21:30
by kukeltje
What part made tge difference?