[SOLVED] Preventing "orphaned" files - How would you handle it?

I had the same problem and my solution was to schedule a garbage collector after the file is created.
In my case, i’m creating files in a Server Side Action and then scheduling a custom API workflow to delete that file

Also, there is an interesting thing about ‘Attach to’ field, it can be filled aparently with any content, so a possible solution could be looking for files where ‘attached to’ contains x value, but i don’t think that lookup is possible right now