Power Apps File Upload with Custom Prefix in Attachment Names
Power Apps provides an Attachment control that allows users to upload files directly from the app interface. These could be any kind of documents that is images, PDFs, certificates, invoices, or identification proofs. Once uploaded, these attachments can be saved to data sources like SharePoint and Dataverse.
By default, when users upload a file, Power Apps retains the original file name exactly as it is on the user’s device. This can become an issue in real-world applications where multiple users are uploading documents with similar or unclear names like image.jpg
or file1.pdf
.

Step 1: Add the Form and Attachment Control
Start by inserting a Form control into your app, and make sure the Attachment column from your SharePoint list is included. Now go into the attachment DataCard and place a Dropdown control inside it. This dropdown will help users select the type of document being uploaded.
Step 2: Create a Prefix Options Collection
On the App’s OnStart
property, add the following code to create a list of prefix options:
ClearCollect(varattach,["Adhar","Pan","Passport"]);
This collection (varattach
) stores the prefix types that will be used to label the attachments.
After that on the dropdown that we have added on the attachment datacard.
On the items property of the dropdown, give the collection name varattach.
varattach
Step 3: Set Up a Collection to Store Attachments
Still in the OnStart
property of the app, add this line to initialize a collection to hold the uploaded files
On the Apps Onstart property,
ClearCollect(varattachfile,Defaults('Basic Information').Attachments);
‘Basic Information’ is the name of the sharepoint list.
Step 4: Add Logic to Rename Files with Prefix

In the OnAddFile
property of the Attachment DataCardValue control, add the following formula:
ClearCollect(
varattachfile,
Self.Attachments
);
UpdateIf(
varattachfile,
!(First(
Split(
DisplayName,
"-"
)
).Value in varattach),
{
Name: Dropdown2.Selected.Value & "-" & Name,
DisplayName: Dropdown2.Selected.Value & "-" & DisplayName
}
)
This logic does two things:
- Collects the newly added files into
varattachfile
. - If the file doesn’t already have a prefix (based on the dropdown), it adds one dynamically to both the DisplayName and Name properties.
Step 5: Display the Updated Attachment List
Now go to the Items property of the same attachment control and set it to:
varattachfile
This ensures that the attachment control displays the renamed files with the prefix applied.
Now its working the prefix is added to the attachment name.
Step 6: Clear Collection on New Form
To avoid showing previously uploaded files when creating a new form entry, clear the varattachfile
collection on the “New Form” button’s OnSelect
property:
Clear(varattachfile);
Step 7: Load Existing Attachments in Edit Mode
When editing a form entry, use the following code on the Edit icon’s OnSelect
property to load the existing attachments into the collection:
ClearCollect(varattachfile,ThisItem.Attachments);
By following this step-by-step approach, you can streamline the process of uploading files in Power Apps while ensuring each attachment is labeled with a clear and meaningful prefix. This not only helps maintain consistency across your documents but also improves user experience by making file identification easier during review or approval processes.
Whether you’re building forms for identity verification, HR onboarding, or document management, this technique can be easily adapted to suit your app’s specific needs.
If you found this blog helpful, feel free to share it with others working with Power Apps. Stay tuned for more practical tips and solutions to enhance your app-building journey!’
Summery:
Renaming Power Apps attachments with a custom prefix isn’t straightforward out-of-the-box. The best approach involves combining Power Apps with Power Automate. You’ll use the standard attachment control in Power Apps to upload files, then trigger a Power Automate flow. This flow retrieves the original attachments, constructs new names with your desired prefix (e.g., item ID or a timestamp), creates new files with these prefixed names, and optionally deletes the originals. This method ensures your files are organized and easily identifiable in SharePoint or Dataverse, despite a slight delay for the automation to run.
✨ Thanks for reading! ✨
I hope you found this blog on the Microsoft Power Platform helpful! From Power Apps, Power Automate (Cloud & Desktop), Canvas Apps, Model-driven Apps, Power BI, Power Pages, SharePoint, Dynamics 365 (D365), Azure, and more, I cover a wide range of topics to help you harness these powerful tools. Don’t miss out on future tips, tutorials, and insights—hit that subscribe button to get the latest posts right to your inbox. 💌
💬 I’d love to hear your thoughts! Drop a comment below with your questions, ideas, or feedback—let’s get the conversation started!
🔗 Let’s connect and grow together!
Follow me, Sanika Thorat, on your favorite platforms for even more content and updates on Microsoft Power Platform and related technologies:
- 💼 LinkedIn – Let’s network and share ideas!
- 💻 GitHub – Explore my projects and code.
- Email Id – thoratsanika98@gmail-com
Let’s build something amazing together with Power Platform and Azure! 🚀!
Power Apps File Upload with Custom Prefix in Attachment Names
Power Apps File Upload with Custom Prefix in Attachment Names
Power Apps File Upload with Custom Prefix in Attachment Names
Power Apps File Upload with Custom Prefix in Attachment Names
Power Apps File Upload with Custom Prefix in Attachment Names
Power Apps File Upload with Custom Prefix in Attachment Names
Power Apps File Upload with Custom Prefix in Attachment Names
Power Apps File Upload with Custom Prefix in Attachment Names
Power Apps File Upload with Custom Prefix in Attachment Names
- Power Apps: Custom File Naming for Attachments
- Rename Power Apps Attachments with a Custom Prefix
- How to Add Prefixes to Power Apps Uploaded Files
- Dynamic File Naming in Power Apps Attachments
- Power Apps & Power Automate: Custom Attachment Prefixes
- Streamline Power Apps Attachments: Custom Naming
- Auto-Prefix Attachments in Power Apps Forms
- Advanced Power Apps File Upload: Prefixing Names
- Customized Attachment Names in Power Apps Solutions
- Enhance Power Apps Attachments with Unique Prefixes
- Power Apps File Upload Control: Custom Naming Hacks
- Prefixing Files on Upload in Power Apps (Step-by-Step)
- Beyond Default: Custom Attachment Naming in Power Apps
- Power Apps Attachments: Automated Prefixing with Flow
- Take Control: Custom File Prefixes in Power Apps Uploads
SEO Sentences for Power Apps File Upload with Custom Prefix in Attachment Names
- Learn how to rename files uploaded in Power Apps with a custom, dynamic prefix using Power Automate.
- Easily implement custom attachment naming conventions for your Power Apps forms to better organize your files in SharePoint or Dataverse.
- This guide shows you the best way to add prefixes to Power Apps uploaded files, ensuring unique and identifiable attachment names.
- Discover how to automate file renaming for attachments in Power Apps, making your data management more efficient.
- Solve the challenge of default file names in Power Apps attachments by applying a custom prefix using a simple Power Automate flow.
- Improve your Power Apps solutions with dynamic file naming for uploaded documents, providing clearer context for each attachment.
- Get step-by-step instructions on prefixing Power Apps attachments based on form data or unique identifiers.
- Master Power Apps file upload customization, specifically how to programmatically add prefixes to all attached files.
- Organize your cloud storage effectively by automatically adding custom prefixes to Power Apps attachments before they are saved.
- Explore techniques for customizing attachment names in Power Apps, enhancing searchability and data integrity within your applications.
Power Apps File Upload with Custom Prefix in Attachment Names
Power Apps File Upload with Custom Prefix in Attachment Names
Power Apps File Upload with Custom Prefix in Attachment Names