If I'm understanding you correctly, you could do away with the extra file (and the need for locking) by putting the info in the filenames themselves. For example
CollectionID_IDX_N_imgname.jpg
where CollectionID is a unique collection identifier, N is the expected total number of images, and IDX the image number within the collection (the collection ID could also be a directory). All you then have to do after having received a new image is a simple glob plus a check for completeness.
Update: forgot to mention that to avoid potential concurrency issues (reading yet incompletely written files), you'd rename a file to its final name only after you've finished writing it.