Questions Tagged With fileuploadhttps://answers.axonivy.com/tags/fileupload/?type=rss&user=ahatiusquestions tagged <span class="tag">fileupload</span>enTue, 21 Jan 2014 20:34:00 -0500Dynamic amount of fileuploads: file not uploadinghttps://answers.axonivy.com/questions/273/dynamic-amount-of-fileuploads-file-not-uploading<p>I'd like to give the user the ability to choose the amount of attachments he'd like to provide. To do this I created a datatable with buttons to add and remove attachment-lines:</p> <pre><code>&lt;p:dataTable id="attachments" var="attachment" value="#{data.attachments}"&gt; &lt;p:column headerText="#{ivy.cms.co('/labels/vendor')}"&gt;&lt;p:inputText value="#{attachment.vendor}" /&gt;&lt;/p:column&gt; &lt;p:column headerText="#{ivy.cms.co('/labels/description')}"&gt;&lt;p:inputText value="#{attachment.description}" /&gt;&lt;/p:column&gt; &lt;p:column headerText="#{ivy.cms.co('/labels/amount')}"&gt;&lt;p:inputText value="#{attachment.amount}" /&gt;&lt;/p:column&gt; &lt;p:column headerText="#{ivy.cms.co('/labels/attachment')}"&gt;&lt;p:fileUpload value="#{attachment.file}" mode="simple" /&gt;&lt;/p:column&gt; &lt;p:column headerText=""&gt;&lt;p:commandButton value="delete-row" update="attachments" action="#{logic.deleteAttachment(attachment)}" /&gt;&lt;p:commandButton value="add-row" update="attachments" action="#{logic.addAttachment()}" /&gt; &lt;/p:column&gt; &lt;/p:dataTable&gt; </code></pre> <p>The only problem is, that it seems to not upload the specified file. The submitted form is beeing processed by this script, the output of <strong>in.test</strong> beeing <strong>false</strong>:</p> <pre><code>for(Integer i = 0; i &lt; in.attachments.size(); i++) { in.test = in.attachments.get(i).file.exists().toString(); } </code></pre> <p>The Simple-Fileupload-Demo works, so I guess it can't be a problem with my installation / computer. I just cleared all of the attachments and uploaded only one. So while this is a foor loop, it just iterates through 1 time. Data is stored in my own Data Class <strong>Attachment</strong>, containing 4 attributes (Vendor, Description, Amount and File).</p>ahatiusTue, 21 Jan 2014 20:34:00 -0500https://answers.axonivy.com/questions/273/dynamic-amount-of-fileuploads-file-not-uploadingjsffileupload