cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tareenmj
Helper I
Helper I

Renaming a file but keeping original type

I have a flow process (in which a user submits a file via a Microsoft Form, I parse the JSON, and then upload that image to a Sharepoint Library with a different name). Because I am changing the name, I am unable to keep onto the file type (i.e. png, jpeg, jpg, etc). Is there anyway to extract file type if you parse JSON or from the filename? 

 

My current process is as follows: 

parse JSON 1.PNGparse json 2.PNG

 

As you can see, I am hardcoding the file type as png but then if the user submits a jpeg, I run into issues. Is it possible for me to extract the filetype?

1 ACCEPTED SOLUTION

Accepted Solutions
v-yujincui-msft
Community Support
Community Support

Hi @tareenmj ,

 

Maybe you could get the file extension by the expressions.

I have made a test for your reference.

 

1. Here is my Form.

vyujincuimsft_0-1656065038477.png

2. Here is my Flow.

last(split(items('Apply_to_each')['name'],'.'))

vyujincuimsft_1-1656065078003.png

vyujincuimsft_3-1656065984355.png

Result Screenshots:

vyujincuimsft_4-1656066073473.png

vyujincuimsft_5-1656066143036.png

 

 

Best Regards,
Charlie Choi

View solution in original post

1 REPLY 1
v-yujincui-msft
Community Support
Community Support

Hi @tareenmj ,

 

Maybe you could get the file extension by the expressions.

I have made a test for your reference.

 

1. Here is my Form.

vyujincuimsft_0-1656065038477.png

2. Here is my Flow.

last(split(items('Apply_to_each')['name'],'.'))

vyujincuimsft_1-1656065078003.png

vyujincuimsft_3-1656065984355.png

Result Screenshots:

vyujincuimsft_4-1656066073473.png

vyujincuimsft_5-1656066143036.png

 

 

Best Regards,
Charlie Choi

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (5,570)