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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Attachmentcontrol save...
Power Apps
Unanswered

Attachmentcontrol save to sharepoint : bad gateway

(0) ShareShare
ReportReport
Posted on by 711

Hi,

 

I use an attachmentcontrol to have users select a file and save it to sharepoint

Code in onaddfile:
(Based on a video I saw from Sean Young. My change: insert a bit of guid in the filename to prevent doubles.)

 

 

Set(VarDemoFromAttachmentControl;JSON(Image8.Image;JSONFormat.IncludeBinaryData))
;;UpdateContext({FileGUID:Right(GUID();6)})
;;Set(VarImage;Image8.Image)//
;;Set(Base64Only;Mid(VarDemoFromAttachmentControl;Find(",";VarDemoFromAttachmentControl)+1;Len(VarDemoFromAttachmentControl)-Find(",";VarDemoFromAttachmentControl)-1))
;;Set(VarFileName;Last(AttachmentControl.Attachments).Name & FileGUID & "." & Last(Split(First(AttachmentControl.Attachments).Name; ".")).Result)
;;UpdateContext({lOmschrijving:VarFileName})
;;Set(VarFileLink;PowerAppsToSharePoint_3.Run(Last(AttachmentControl.Attachments).Name & FileGUID & "." & Last(Split(First(AttachmentControl.Attachments).Name; ".")).Result;Base64Only).sharepointfilelink)
;;Reset(AttachmentControl)
;;Reset(TextInput8)

 

 

This is working for almost a year with no problem. I am the owner of the sharepoint site all is stored.

It now has stoppped working when I am the user.

-both with my latest build and with the version published to everyone (evryone except me has no problem)

-on any pc, in any browser

-on an iphone it DOES still work, logged in as me

 

If I ran the code once in the editor I get the following error dot with my attachment control:

 error messageerror message

 

Sorry about the image format but powerapps does not allow me to copy paste thet text.

 

Edit 14-3

When I revert to an older version it does work. It seems that someone else opening the app and myself opening the app in stead of editing it does not mean the vesrions are the same.

Reading back on "bad gateway" errors from other user I do not find solutions, only revert and hope it never happens again.

So my next powerapps day will be reconstructing changes in stead productive alas.

 

 

 

Anyone knows what is going on?

 

Categories:
I have the same question (0)
  • Javier Gallego Profile Picture
    Microsoft Employee on at

    Hi HansHeintz,

     

    Have you tried with more users? after a year it suddenly starts to fail, without any change?
    Have you tried clearing the cache and cookies?

     

    Regards,

    Javier

  • HansHeintz Profile Picture
    711 on at

    In the end I just had to revert to a version where it still worked.

    No code concerning the saving of attachments ever changed between the versions.

    Seems like something that can just "happen"

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard