0
I’m trying to get the name of the files after sending the form:
add_action('gform_after_submission_5', function ($entry, $form) {
$file_url = $entry['5'];
$filename = basename($file_url);
}, 10, 2);
When giving a var_dump $file_url;
he returns it to me (I’m uploading only one file for now):
string(72) "["http://winds.local/wp-content/uploads/2016/04/stabbing312.jpg"]"
And by giving a var_dump $filename;
return this:
string(17) "stabbing313.jpg"]"
How do I make $filename not catch quotes and square bracket?
UPDATING
In doing so:
$foo = explode(",", $file_url[0]);
foreach ($foo as $teste) {
echo $teste.'<br>';
}
It even returns the Urls with the brackets:
["http://winds.local/wp-content/uploads/2016/04/WOLVERINE-THE-X-MEN-11-AVX-Tie-In10.jpg" "http://winds.local/wp-content/uploads/2016/04/stabbing324.jpg"]
What? Quotes and brackets are not the result of the "Print" variable with vardump?
– mau humor
@user5978 the problem is that basename is considering the quotes and conchete at the end as part of the URL. It should stop in jpg, but it includes "]
– marcelo2605