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 / can i automatically ov...
Power Apps
Answered

can i automatically overwrite my old file attachment

(0) ShareShare
ReportReport
Posted on by 8

Hi, I am just new with powerapps and I am trying to create a ticketing application where the users can also attach files. 

 

I am having issue with the attachment because my client want to automatically overwrite the old file with the same file name. but in powerapps whenever i upload a new file with the same filename as the old one, it only retains the old one and not the new one. 

 

Is there a way that I can automatically replace the old file?

Categories:
  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @moniing ,

     

    Could you please share more details about your scenario? Which data source are you using? Is there an Attachments Control within your App? 

     

    Best regards,

  • moniing Profile Picture
    8 on at

    Hi,

     

    I am using SharePoint as my data source. Yes, there is an Attachment control, and I am using forms as well.

  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @moniing ,

     

    With Froms and Attachments control as the scenario, the default behavior is list existing files in the Attachments control, there is no way to automatically delete an individual file using functions. That means, users are only allowed to delete a specific file from in the Attachments Control by manually pressing the Cross buttons.

     

    As an alternative, you can update a collection when select an item from Gallery:

    vjefferni_0-1670825727702.png

    Select(Parent);ClearCollect(colAA,ThisItem.Attachments);EditForm(Form3)

    then for the Attachments Control, check file names in OnAddFile property, so the App will notify there is file with same name already and need to delete first.

    vjefferni_1-1670825886812.png

    If(Last(DataCardValue17.Attachments).Name in colAA.DisplayName, Notify("Duplicate file found, please remove the original one first", NotificationType.Warning))

     

    Hope this helps.

     

    Best regards,

  • moniing Profile Picture
    8 on at

    Thank you so much for the help! 

     

    One last thing, because I have a submit button, is it possible for me to disable the button if i get the warning?

     

     

  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @moniing ,

     

    You can disable the submit button based on the quantity of files within the Attachments Control:

    If(CountRows(Distinct(DataCardValue17.Attachments,Name)) < CountRows(DataCardValue17.Attachments), DisplayMode.Disabled, DisplayMode.Edit)

     

    So, if the number of distinct files is less than the number of all files, the button is disabled.

     

    Best regard,

  • moniing Profile Picture
    8 on at

    I will try this solution, thank you very much!

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 381 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 340

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard