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 / Remove or Overwrite at...
Power Apps
Unanswered

Remove or Overwrite attachments within a Collection

(0) ShareShare
ReportReport
Posted on by 49
Hello Power Apps Community,
 
I have a Power Apps form connected to a SPO list that contains attachment control.
 
The display name of the attachment needs to be renamed based on the selection made by the user on a dropdown list so I´m working with a collection in order to accomplish this.
 
The issue I am facing that once I submit the form with the attachment, then if I open this item in edit mode & remove the previous attachment and upload another one with the same name and submitting, the old/previous attachment is the one that remains not the new one.
 
I need to either be able to remove the attachment with the X or overwritte the attached document when another one with the same display name is uploaded and the form is submitted. This is the collection I´m using on the OnAddFile Property of the attachment control:
 
Set(varExtension,Find(".",Last(attachCedula.Attachments).Name));
Set(varExtension2,Mid(Last(attachCedula.Attachments).Name,varExtension));
ClearCollect(
    colCedulaAttachs,
    attachCedula.Attachments
);
 
UpdateIf(
    colCedulaAttachs,
    !StartsWith (DisplayName,DataCardValueCed_Exp.Text),
    {
        Name: DataCardValueCed_Exp.Text & "-" & DataCardValue_CodReq.Text & varExtension2,
        DisplayName: DataCardValueCed_Exp.Text & "-" & DataCardValue_CodReq.Text & varExtension2
    }
);
RemoveIf(
    colExpedienteAttachments,
    DataCardValueCed_Exp.Text in DisplayName
);
Collect(
    colCedulaAttachs,
    colExpedienteAttachments
   
   
);
 
As you can see it is not removing the files. I´ve tried adding another collection called "colExpedienteAttachments" but to no avail. 
 
On the OnRemovefile and OnUndoRemoveFile I´ve got "false".
 
Please help.
Thanks.
Categories:
  • WarrenBelz Profile Picture
    156,926 Most Valuable Professional on at
    Hi @AlexBS​​​​​​​
    The fundamental issue here is that the only way in Power Apps (excluding Power Automate) of adding the actual file content is with the attachment control itself. You can do all the file name manipulation as you are presently, but if you have a look in the collection, the Value field is a BLOB (Binary Large Object) reference that can only be changed/added by the control.
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    Buy me a coffee
  • AlexBS Profile Picture
    49 on at
    Anyone with a suggestion on this please

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 194 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 150

Last 30 days Overall leaderboard