Link to only the "filename" of uploaded PDF files.

15 February, 2024 07:00:38
Alain Melsens
Topics: 8
Messages: 50
Hello,
How can I display only the filename of uploaded PDF files with a web link?
I thought I could use the following syntax, but this does not work. Nothing is shown:
[e2pdf-format-output explode="," explode_filter="array_filter" filter="trim" output="{0}" get_file_name="true"]{Upload-2:1}[/e2pdf-format-output]
I don't want to have the whole path, only the filename is needed to display.
See screen copie how I use these instructions on an HTML-object in the E2PDF Builder.
Thanks for any help.
Best Regards.
15 February, 2024 07:22:40
Alain Melsens
Topics: 8
Messages: 50
Hi,
I I would like to add that I found a PHP code snippet that outputs the "get_file_name" as shortcode. See your PHP code at: https://codefile.io/f/Uip5ymJdJe
But even with that PHP snippet running yet, it's not working.
15 February, 2024 07:34:04
Alain Melsens
Topics: 8
Messages: 50
Hi,
I was forgotten to mention that I use "Forminator" plugin with E2PDF.
15 February, 2024 08:46:49
E2Pdf
Support
Topics: 7
Messages: 3163
Hello,

The code is for Gravity Forms, not for Forminator. Can you please clarify:

- Do you have a single file upload field with multiple file upload option?

- Is it located in the repeater/group field?
We would really appreciate your feedback at WordPress.org!
15 February, 2024 23:17:51
Alain Melsens
Topics: 8
Messages: 50
Hello,
Yes, a have a single file upload field with multiple file upload option within a repeater/group field.
Could this cause problems? However, this seems to me to be a very practical arrangement within the Forminator form. This works as expected.
Afterwards, the photos are displayed properly with separate PDF files underneath normally then containing, for example, price quotes. For this, I only wish to show the PDF file names as web links to the uploaded PDF files. The web links work fine, but I cannot get the names of the PDF files displayed as text labels on the web links. This doesn't work.
See also screenshots to clarify things.
15 February, 2024 23:29:16
Alain Melsens
Topics: 8
Messages: 50
Hello,
I still want to include myself the references to the loaded PDf files as I assume these references are.
In the repeater/groupfield, it is possible to choose at least 1 uploaded photo and at least 1 uploaded PDF file. The rest as maximum 3 rows of maximum 3 photos to be landed and 3 accompanying PDF files. So at least 1 photo and 1 PDf file is required. The rest are optional.
I suppose the references of the charged PDF files are as follows:
{0}{Upload-2:1} {1}{Upload-2:1} {2}{Upload-2:1}
{0}{Upload-2:2} {1}{Upload-2:2} {2}{Upload-2:2}
{0}{Upload-2:3} {1}{Upload-2:3} {2}{Upload-2:3}
For the pictures the existing references are: (these are working great)
{0}{Upload-1:1} {1}{Upload-1:1} {2}{Upload-1:1}
{0}{Upload-1:2} {1}{Upload-1:2} {2}{Upload-1:2}
{0}{Upload-1:3} {1}{Upload-1:3} {2}{Upload-1:3}

So, I need the filenames of the uploaded PDF-files as for the references:
{0}{Upload-2:1} {1}{Upload-2:1} {2}{Upload-2:1}
{0}{Upload-2:2} {1}{Upload-2:2} {2}{Upload-2:2}
{0}{Upload-2:3} {1}{Upload-2:3} {2}{Upload-2:3}

I hope I could clarify a bit more with this?
16 February, 2024 00:27:01
E2Pdf
Support
Topics: 7
Messages: 3163
Hello,

Yes, it's clear. Here is the code snippet for Forminator: https://collabedit.com/7n7h8

After adding a snippet, you must be able to use the shortcode as:

For the 1st row:

[e2pdf-format-output explode="," explode_filter="array_filter" filter="trim" output="{0}" get_file_name="true"]{upload-2:1}[/e2pdf-format-output]

[e2pdf-format-output explode="," explode_filter="array_filter" filter="trim" output="{1}" get_file_name="true"]{upload-2:1}[/e2pdf-format-output]

[e2pdf-format-output explode="," explode_filter="array_filter" filter="trim" output="{2}" get_file_name="true"]{upload-2:1}[/e2pdf-format-output]

For the 2nd row, it must be changed {upload-2:1} to {upload-2:2} and so on.

P.S. Filter will modify the path as https://example.com/uploads/...../O83965HY-name.jpg to name. There are comments on the name conversion so if you need another format, like keep extension, remove the line where the comment says: "name.jpg to name".

P.P.S. You must remove the previously added snippet with "get_file_name" prepared for Gravity Forms.
We would really appreciate your feedback at WordPress.org!
16 February, 2024 00:57:39
Alain Melsens
Topics: 8
Messages: 50
Hello,
Thank you very much for your help. We are almost there.
Because now I still see https//pathname etc.
I wish to see only the last part, so only the "PDF file name including the .pdf extension", nothing from the path stucture is needed. Which filter in that code snippet should I keep then. This is not very clear. See also the screen copie.
16 February, 2024 01:01:31
E2Pdf
Support
Topics: 7
Messages: 3163
If you need with extension, here is the code: https://collabedit.com/kdxac.

"https" must not appear. What's the value of the "HTML" object? Can you please attach the screenshot?
We would really appreciate your feedback at WordPress.org!
16 February, 2024 01:33:57
Alain Melsens
Topics: 8
Messages: 50
YES!! It's working!
This is what I wanted. This is brilliant. Exactly what I meant.
Incredible what is possible with E2PDF and your fantastic support. We are already customers and now we might buy an additional licence.
Really great work you guys are doing.
I am very satisfied with the result.
E2PDF with WordPress and a bit of separate PHP code and one can really create practical online applications.
I can go on with this.
Have a nice day. ;)