Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderator: amosbatto

Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
#824904
Can I download all the attachment files in dynaform only with one button/click?
Because sometimes my dynaform contains many uploaded documents and it's gonna be good for the user if they can download all of it at the same time instead of download the file one by one. Thankyou for your help.
#824910
There is no easy way to implement this.

You can download a single file in a MultipleFile field with this JavaScript:
$("#MultipleFileID").find("a.fa-download").aFiles.eq(X)[0].click();

Where MultipleFileID is the ID of the Multiple File field and X is the index number, such as 0, 1, 2, 3, etc.


However when I tried this code, I found that FireFox 60 and Chrome will only allow you to download one file and ignores the other download attempts. I tried this code:
Code: Select all
$("#downloadAll").find("button").click( function() {
  var aFiles = $("#specFiles").find("a.fa-download");
  var i = aFiles.length - 1;
  
  for (; i >= 0; i--) {
    aFiles.eq(i)[0].click();
  }
} );
I also tried using a settimeout() to download at different times, but I couldn't get it to work.

The only solution is to fire a trigger beforehand that queries the APP_DOCUMENT table in the database, and then uses exec("tar -cf files_case_X.tar file1 file2 file3") to create a tar file which contains all the files from the case. Then, use PMFAddInputDocument() or G::uploadFile() to add that tar file to the case. Then, display a link in the Dynaform to download that tar file.
mysqli_free_result() error

Hello good afternoon I am having the same problem[…]

Thanks!

Hi, This user API https://wiki.processmaker.com/[…]

display pdf in panel control

Is there any solution?