cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Uploaded photo to onedrive from powerApp is corrupted

Hello,

 

I've used the following flow to upload the image to onedrive for business from MS Power APP

upload image flow.PNG

 

But when I run the app and trigger Microsoft Flow, the image get uploaded but the image file get corrupted and doesnt show the preview in the onedrive. 

Would really appreciate if someone explain the best way to upload the image on onedrive without it get corrupted.

corrupt.PNG

 

plant error.PNG

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @Anonymous ,

Could you please share a bit more about your scenario?

How do you capture the picture within your app? Using "Add Picture" control?

 

Based on the screenshot that you mentioned, I suppose that you use the "Add Picture" control to capture the picture within your app, is it true?

 

Based on your flow's configuration, I think there is something wrong with it. Actually, the output of the "Add Picture" control is not a image data url, instead, it is a reference to the uploaded picture within your "Add Picture" control, the format as below:

appres://blobmanager/5605abc5abb14bcc92565a61933be00c/1

I have made a test on my side, please take a try with the following workaround:

App's configuration as below:4.JPG

Set the OnSelect property of the "Upload" button to following:

'20190704_case5'.Run(TextInput1.Text, Substitute(JSON(UploadedImage1.Image, JSONFormat.IncludeBinaryData),"""",""))

On your side, you should type:

'UploadPhotosToOneDrive'.Run(NewZone_TextInput_1.Text, Substitute(JSON(UploadedImage1.Image, JSONFormat.IncludeBinaryData),"""", ""))

 

Flow's configuration as below:5.JPG

Within the "Create file" action, set the File Content filed to following formula:

dataUriToBinary(triggerBody()['Createfile_FileContent'])

Please consider take a try with the above solution, then check if the issue is solved.

 

More details about the JSON function in PowerApps, please check the following article:

JSON function

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

9 REPLIES 9
PA_CL_DEV
Regular Visitor

i recommend to use the workaround by using a unused e-mail trigger, which allows you to upload the photo to the sharepoint in the right format:

http://johnliu.net/blog/2019/4/flowninja-hack-87-lock-microsoft-flow-powerapps-trigger-to-upload-ima...

worked like a charm in my case.

Anonymous
Not applicable

Hi @PA_CL_DEV  Thanks for the reply. But I need the solution for onedrive. The suggested solution is for the sharepoint. Can you suggest the right approach to upload to image to onedrive?

Have you tried to just use a OneDrive "Create File" block instead of the Sharepoint "Create File" block? something like this:

2019-07-03_16-03-01.png

Anonymous
Not applicable

Thank you @PA_CL_DEV . 

 

I'm pretty sure I'm doing something wrong here, I've tried your solution but I couldn't figure out how to do it in the right way. Guess I'm the beginner here who is banging his head on dumb questions. If there is already built flow available please share it with me that would be a great help. Thank you

v-xida-msft
Community Support
Community Support

Hi @Anonymous ,

Could you please share a bit more about your scenario?

How do you capture the picture within your app? Using "Add Picture" control?

 

Based on the screenshot that you mentioned, I suppose that you use the "Add Picture" control to capture the picture within your app, is it true?

 

Based on your flow's configuration, I think there is something wrong with it. Actually, the output of the "Add Picture" control is not a image data url, instead, it is a reference to the uploaded picture within your "Add Picture" control, the format as below:

appres://blobmanager/5605abc5abb14bcc92565a61933be00c/1

I have made a test on my side, please take a try with the following workaround:

App's configuration as below:4.JPG

Set the OnSelect property of the "Upload" button to following:

'20190704_case5'.Run(TextInput1.Text, Substitute(JSON(UploadedImage1.Image, JSONFormat.IncludeBinaryData),"""",""))

On your side, you should type:

'UploadPhotosToOneDrive'.Run(NewZone_TextInput_1.Text, Substitute(JSON(UploadedImage1.Image, JSONFormat.IncludeBinaryData),"""", ""))

 

Flow's configuration as below:5.JPG

Within the "Create file" action, set the File Content filed to following formula:

dataUriToBinary(triggerBody()['Createfile_FileContent'])

Please consider take a try with the above solution, then check if the issue is solved.

 

More details about the JSON function in PowerApps, please check the following article:

JSON function

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Dear Kris Dai,

I have the same issue. I followed your instruction and ended up with the error "Invalid number of arguments: received 2, expected 1."

Could you kindly help please?

Thank you very much.

Best regards,

Nam

JoaoN
Helper IV
Helper IV

I am having the same issue, of you @Nam117  =/

Nam117
Frequent Visitor

Dear JoaoN,

I got help from @WarrenBelz . Please find his comment here https://powerusers.microsoft.com/t5/Building-Power-Apps/Help-to-upload-image-with-a-proper-name-to-o...

Hope it could help.

Thanks

Hello @Nam117 . Thank you!

I solve it with your suggested post. But the I really can´t understand what happened to me. I found this post a few weeks ago. I use the Xida solution and it works fine (use the exactly solution provided by Xida). Last week I was checking some flows and decided to implement in another environment, so I got the same error that you got.
In one app, the flow works fine. The same flow in another app not. ahaha

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (78,507)