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.
By kleung
#824304
Hi,

I have defined an input file in dynaform for file upload. In order to allow users re-upload the file when they clicked on wrong files, I set an iteration to the task. When the task is re-iterated, the filename and filename_label of the upload file variable are set to "". I could allow user to re-upload their files. However, I cannot clear the old file name of the previous selected file appeared in the file selection field.

Grateful if I can be advised how to clear the field value.

I'm using Bitnami 3.2.1 on Linux version.

Many Thx

cheers,
Karl
User avatar
By amosbatto
#824333
Is there any reason why you can't use a MultipleFile field? It allows your users to delete the files.

Deleting files from File fields is complicated. You have to change the database record. I can write up a solution if absolutely necessary, but why can't you use a MultipleFile field? If you only want the user to upload 1 file, see:
https://www.pmusers.com/index.php/Limit ... aded_files
By kleung
#824372
Hi Amos,

Thank you for your advice. Your approach serve the functional purpose.
Since I allow users upload only ONE file. Users can be confused that they are allowed to upload more than one files but error message popped up.
Can the button of file uploading be locked or hide as well as changing the label of the button after users have uploaded the maximum amount of files?

Alternatively, a solution with Single File upload would be required.

which approach would be simpler?

thousand thanks

cheers,
Karl
User avatar
By amosbatto
#824383
kleung wrote:Since I allow users upload only ONE file. Users can be confused that they are allowed to upload more than one files but error message popped up.
Can the button of file uploading be locked or hide as well as changing the label of the button after users have uploaded the maximum amount of files?
Karl, I added an example of how to hide the button to upload more files:
https://www.pmusers.com/index.php/Limit ... ect_number

The File field has so many limitations, that I can't recommend using it.
By kleung
#824473
Hi Amos,

thanks for your code. The "File Upload" button was hide after the number of files reach the upload limit.

However the "Submit" button followed is disabled and hence the form could not be submitted.
Please advise how to fix it.

Many Thanks.

cheers,
Karl
By kleung
#824503
Hi Amos,

I used your code and works now.

By the way, I could get the ID and filename with the code
if (isset(@=multipleContractFiles) and !empty(@=multipleContractFiles)) {
@@firstFileId = @=multipleContractFiles[0]['appDocUid'];
@@firstFilename = @=multipleContractFiles[0]['name'];
}
from https://wiki.processmaker.com/3.2/Multi ... e_Uploader.
But I could not find the Path field in the APP_DOCUMENT table.
My files are Excel files.
How can I get the paths of the files uploaded such that I can pass them to PhpSpreadsheet to load the contents into a grid?

Thousand Thanks again.

cheers,
Karl
User avatar
By amosbatto
#824516
You can get the file's path on the ProcessMaker server like this in a trigger:
Code: Select all
@@firstFileId = @=multipleContractFiles[0]['appDocUid'];
@@firstFilename = @=multipleContractFiles[0]['name'];
$firstVersion = @=multipleContractFiles[0]['version'];

//construct path to the stored file in the server's file system:
$ext = pathinfo(@@firstFilename, PATHINFO_EXTENSION);
$g = new G();
$path = PATH_DOCUMENT . $g->getPathFromUID(@@APPLICATION) . PATH_SEP .
         @@firstFileId . '_' .  $firstVersion . '.' . $ext;

okay thanks

Amosbatto, PMUsers.com is down.

It would be nice if ProcessMaker can let us know w[…]

Hi, What is your server config? Is your server Wi[…]

Filtering Grids For Parallel Tasks

Hi, You must create a grid for example @=tempGrid[…]