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
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

5 REPLIES 5
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

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

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Top Solution Authors
Top Kudoed Authors
Users online (60,445)