how do I ensure HTTP file upload (ie multipart etc) is transactional?


How can I ensure that if I am doing a HTTP file upload (e.g. say to
update an existing file from v1 in my web application to v2) that it
acts transactionally?

That is in this case assume my web application has v1 of the file, but
as part of the admin interface I can update this file. If whilst
uploading v2 there is an issue with the file upload I want to ensure
v1 is still in place, and not some corrupt v2 copy instead.

Another way of asking this question might be whether I can let the
server-side file upload code to point the file directly to where it
has to go, OR whether (if HTTP file upload isn't transaction) I really
need to put in some additional server side code to do a two step
process of (a) upload to temporary location and then (b) if successful
then transfer it into the final location (but I'd still want to give
the client an indication of whether the overall upload worked or not
too), and (c) there are some database status fields to update also on
the server side.

Any suggestions in terms of a good approach welcome.