Basically what you need to do is keep track of three numbers. The first is how
many files are already attached. Second is the number of files about to be
attached (i.e. how many of the file upload controls are NOT blank). Third is
the number of "remove this file" checkboxes that are checked.
First + second - third = number of files after saving.
The trouble with this approach is that you need to make the user select files
to upload at the same time as they select those to delete. If you do the two
operation separately then you run the risk of the session being closed!
Erik, I've done something very similar to this before. There's also this article which may help:
http://www.codestore.net/store.nsf/unid/DOMM-4RQJN8?OpenDocument
Basically what you need to do is keep track of three numbers. The first is how many files are already attached. Second is the number of files about to be attached (i.e. how many of the file upload controls are NOT blank). Third is the number of "remove this file" checkboxes that are checked.
First + second - third = number of files after saving.
The trouble with this approach is that you need to make the user select files to upload at the same time as they select those to delete. If you do the two operation separately then you run the risk of the session being closed!