I have a php site am trying to track number of times my downloads get hit using the following code:
//update download count
update_attachment_counter($attachment);
// We'll be outputting a PDF
header ( 'Content-Type: application/pdf' );
header ( 'Content-Disposition: inline; filename="fileName.pdf"');
header('Content-Length: ' . filesize($attachment));
readfile ( $attachment );
die ();
I am seeing my counters go up multiple times per download. My attachments are anywhere from 2 to 30MB in size. Does it make since that I am seeing multiple requests per download? How do I only track each download once?