cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
imaliasad
Level: Powered On

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 Team
Community Support Team

Re: Uploaded photo to onedrive from powerApp is corrupted

Hi @imaliasad ,

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
PA_CL_DEV
Level: Powered On

Re: Uploaded photo to onedrive from powerApp is corrupted

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.

imaliasad
Level: Powered On

Re: Uploaded photo to onedrive from powerApp is corrupted

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?

PA_CL_DEV
Level: Powered On

Re: Uploaded photo to onedrive from powerApp is corrupted

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

imaliasad
Level: Powered On

Re: Uploaded photo to onedrive from powerApp is corrupted

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 Team
Community Support Team

Re: Uploaded photo to onedrive from powerApp is corrupted

Hi @imaliasad ,

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,981)