How to edit form with existing uploaded file
I have a simple form which requests text data, and has a file input. When the data is entered and a file selected, it is uploaded and becomes part of the record.
I'm wondering what is the correct UI/UX for when the user wants to edit this form, specifically in regards to the file.
My idea was to show the existing filename with a "Delete file" link, and a hidden file form element. If the user clicks "Delete file", the request is done via ajax, and if successful the file form element is made visible.
What has me considering this approach is that I'm making permanent changes without ever clicking the "Save" button. So the user could delete the file, then click Cancel, but a change would have occurred.
Is there a known pattern for this?