Problem wit JSF (Myfaces) t:inputFileUpload

If you are facing problem of the kind that some files get uploaded and some other files not.

for the first time you will off course debug the attachment handler action method of your command Button that is associated with the t:inputFileUpload and you will notice a strange behavioure that for the fiels that is uploaded successfully the action method (responsible for manipulating the uploaded file) get invoked as expected, but for those files that not uploaded and more over may destory your other form data, this method not invoked.

Solution:

check the MultiPart filter in your web.xml

it will look like:

<filter>
    <filter-name>extensionsFilter</filter-name>
        <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
        <init-param>
                <description>Set the size limit for uploaded files.
                       Format: 10 - 10 bytes
                      10k - 10 KB
                      10m - 10 MB
                      1g - 1 GB
                </description>
                <param-name>uploadMaxFileSize</param-name>
                <param-value>100m</param-value>
        </init-param>
        <init-param>
                <description>Set the threshold size - files below this limit are stored
			     in memory, files above this limit are stored on disk.
                         Format: 10 - 10 bytes
                         10k - 10 KB
                         10m - 10 MB
                         1g - 1 GB
                 </description>
                 <param-name>uploadThresholdSize</param-name>
                 <param-value>100k</param-value>
         </init-param>
         <init-param>
<param-name>uploadRepositoryPath</param-name>
<param-value>/temp</param-value>
<description>Set the path where the intermediary files will be stored.
</description>
</init-param> </filter>

­
check the Highlighted section and make sure uploadRepositoryPath have an existing and accessiblepath.

 and this will solve your wired problem.

My business is at sake here,

My business is at sake here, if you guys don't know how to handle an article like this. - Reba Rambo-McGuire

Powered by Drupal - Design by artinet