                         log.raw err
                         cb()
 
+                # Append the stream photo to the archive.
                 laterStream.on 'ready', (stream) ->
+                    # Get the file's name in the archive.
+                    name = photo.title or "#{photo.id}.jpg"
                     archive.append stream, {name}
                     cb()
 

                # Start the streaming.
                archive.pipe res

                # Arbort archiving process when the user aborts his request.
                res.on 'close', ->
                    archive.abort()


                res.setHeader 'Content-Disposition', disposition
                res.setHeader 'Content-Type', 'application/zip'

                # Append all photos to the archive.
                async.eachSeries photos, addToArchive, (err) ->
                    if err
                        log.error "An error occured: #{err}"
                    else
                        # Make the archive as ready.
                        archive.finalize()


