The System.FileDocument, due to it's implementation always autocommits. You hvae to handle this behaviour in custom logic.
A way to do this is to keep track of an attribute _isNew or something similar on true when uploading, setting it to false when saving, and removing any FileDocuments where _isNew is true when the session ends. You might also need some access rule xpath restriction to the owner, as else other users might have access while it's in the database
Hi Ahmer,
check these community question
https://community.mendix.com/link/space/korean-community/questions/141855
or use this method to solve the answer both are same if you understand the below answer gothrough the above posted link
Automatic Commit After File Upload:
When a file is uploaded using the file dropper, it automatically commits the file to the system.Add Attribute (isSaved):
Add an attribute named isSaved to track whether the file has been successfully committed. After committing the file, set isSaved to true.Retrieve from Database with Condition:
When retrieving documents from the database, filter the results by checking the condition isSaved = true.This ensures that only the uploaded and committed documents are displayedcheck the list count it will show correctly.