@Sayyied2022
So I did some testing and learned that the dynamic content that holds the filename is actually a string list that contains other data.


For MarconettiMarco's suggestion to work, we need to extract the filename from that content. Here is an expression you can use to do that (replace the bold section with your dynamic content. You may need to do some trial and error to find the right one. Ex. dump them all into a compose, run it, check the results to see which one has the data you want):
json(outputs('Get_response_details')?['body/r4550c900756e412eb445dac014bc7d43'])[0]['name']
With the expression, we're converting the string list to a JSON array. The [0] means we're selecting the first (and in this case, only) "row" of data from the array, then the ['name'] means we're selecting the name field which holds our filename.
So now that we have extracted the filename, I'd like to make a small change to MarnettiMacro's code. He's suggesting to perform a split at each occurrence of an underscore ("_") then selecting the first element returned by that split. But what if the person submitting a photo already has/puts their own underscores in the filename? Then we're going to be missing part of the filename. So in actually, we only want to remove everything after the last underscore (but keep the file extension).
Here's an expression that will remove everything (except the file extension) after the last underscore:
replace(outputs('Compose'), concat('_', last(split(outputs('Compose'),'_'))), concat('.',last(split(outputs('Compose'),'.'))))
In the above expression above, we're identifying everything after that's after last underscore, then replacing it with just file extension. The concats are there to add the in the little bit of text that got lost through the splitting.

There may be other ways to accomplish the same as the expression above, but this should work for your purposes.