I need to get just the file name from a file submitted in a Webform.

In actions, I try to execute the following code at a "Show a message on the site" action:

$path = "[data:component-value]";/*a REPLACEMENT PATTERN that return http://mysite.com/files/webform/submittedfile.pdf*/
$file = basename($path);/*$file is set to "submittedfile.pdf"*/
echo $file; /*this *should* return submittedfile.pdf*/

But ALWAYS return http://mysite.com/files/webform/submittedfile.pdf

I've tested ltrim, rtrim, god_trim_for_me and chop. And it always return the full URL.

What am I doing wrong?


I have managed to find an answer to my question

What I am doing wrong:

$path need set before.

Add a variable first, after do a echo

In the value: [data:component-value] Named the variable (ex: link_from_hell)

So, the next action you can manipulate the $patch.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.