web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Extracting file name a...
Power Automate
Answered

Extracting file name and using within flow

(1) ShareShare
ReportReport
Posted on by 35

Hello!

 


I have a flow where I wish to extract the filename of the file, but without the extension.

 

So if it was "somepicture.jpg", I want to use "somepicture" in the HTTP post later on.

 

My flow looks like this:

flow.jpg

 

I have spent a lot of time trying to get this to work, and have tried multiple options for extracting the filename.

 

I am sure that I must be close.. but I can't quite figure it out.

 

Any ideas? I'm happy to do it another way, just as long as it works.

 

Thanks!

Categories:
I have the same question (0)
  • v-yamao-msft Profile Picture
    on at

    Hi @agour,

     

    To extract the file name of the file without the extension, please try to combine functions split and first.

     

    You could use the following code:

    first(split(triggerOutputs()['headers']['x-ms-file-name-encoded'],'.'))

     

    Then you could use the output from the Compose in the next action.

    1.PNG

     

    Please try it on your side.

     

     

    Best regards,

    Mabel Mao

  • agour Profile Picture
    35 on at

    Hi Mabel,

     

    I tried your suggestion, which makes sense to me.

     

    The output from the compose action is a random string of charectors. Any idea what is going on?

     

    flow.jpg

     

    The actual filename was "McGoff_00018.jpg"

     

     

    Thanks!

  • agour Profile Picture
    35 on at

    Bump - any further ideas? I still need to try and get this fixed

  • agour Profile Picture
    35 on at

    I have tried using Onedrive as the input, rather than ftp... and I still get the same issues.

     

    I also tried using a replace function:

     

    replace(triggerOutputs()['headers']['x-ms-file-name-encoded'], '.jpg', '')
     
    And I still get the same strange string of charectors as the output..
  • Verified answer
    agour Profile Picture
    35 on at

    Fixed it!

     

    I don't know why - but using the dynamic expression for 'filename' always gives a garbled end result.

     

    The only way to do it, was to initialise the variable first, and then later use it.

     

     

    flow3.jpg

  • SantoshBuddha Profile Picture
    27 on at

    Using 

    base64ToString should give you the correct Name.
    base64ToString(triggerOutputs()?['headers/x-ms-file-name-encoded'])
  • Community Power Platform Member Profile Picture
    on at

    That was my solution to get the name of my pdf file. Thanks! 

  • swatisuman0921 Profile Picture
    3 on at

    Thanks @SantoshBuddha , this worked!!!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 398 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 323 Super User 2025 Season 2

#3
Expiscornovus Profile Picture

Expiscornovus 183 Most Valuable Professional

Last 30 days Overall leaderboard