mark_nsx Posted December 13, 2006 Share Posted December 13, 2006 Hi there,Im working on a script which facilitates file download off of a server (.zip files)and I would like to know how to detect a successful download..This is the approach I have tried so far but failed (tried comparing the return value of fpassthru with the stored file size of the file to be downloaded)... Any ideas? thanks![code]// Set headers header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=$file_name"); header("Content-Description: File Transfer"); // Read file to download $fp = fopen("$file_url", "r"); $res = fpassthru($fp); // Successful download if ($res == $file_size) { // Update product download date/# of downloads $order->updateOrderHistory($order_ID, $prod_ID); } // Close file pointer fclose($fp);[/code] Link to comment https://forums.phpfreaks.com/topic/30467-how-to-detect-a-successful-file-download/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.