Brilliant analysis by Praveen (as always) on the inner workings of how the temp file function works.
Inaki,
My two cents on what you've brought up. IMHO message digest/checksum and temp file serve different purposes:-
i) Message digest/checksum - to ensure that the data/file is exactly as the source and have not been tampered with in transit
ii) Temp file name - to ensure that the target file (with the intended filename) is complete prior to being processed by subsequent application
A side benefit of the message digest/checksum approach is that it also ensures completeness of the target file. On the other side, temp file name cannot guarantee data integrity because there is possibility of file being modified by some other process/application after it has been delivered by PI but prior to it being processed by the receiver application.
It really depends on the actual requirement by Pratik. If it is just to ensure that partial files are not picked up, then temp file approach is more than enough to cater for this - going for the MD5 option is just overkill as it requires additional development on both PI side as well as receiver application.