The <p:commandButton>
, which sends by default an ajax request, doesn't support uploading files by ajax. For that you should be using <p:fileUpload mode="advanced">
instead.
Add ajax="false"
to the <p:commandButton>
to turn it off.
<p:commandButton ... ajax="false" />
Note that <p:fileUpload mode="simple">
, which could also be used instead of Tomahawk <t:inputFileUpload>
, also requires this.
Unrelated to the concrete problem, writing uploaded files to expanded WAR folder is a really bad idea. Reason #1 is that they all get lost whenever you redeploy the WAR or even when you restart the server, for the simple reason that they are not contained in the original WAR. Store them elsewhere in a more permanent location. See also among others this related answer: Uploaded image only available after refreshing the page.