Ok! I was looking through an AJAX upload script and what it did was open the temp file up and get its size.
Taken from Uber Uploader (uber_get_progress.php).PHP://Class to store read info class ReadStatus{ var $is_dir_error = 0; var $open_dir_error = 0; var $active = 0; var $uploaded_files = 0; var $bytes_uploaded = 0; } // Return the current size of the $_GET['temp_dir_sid'] - flength file size. function GetBytesRead($temp_dir, $upload_id){ $read_status = new ReadStatus; $temp_upload_dir = $temp_dir . $upload_id . '.dir'; $flength_file = $temp_dir . $upload_id . '.dir/' . $upload_id . '.flength'; if(is_dir($temp_upload_dir) && file_exists($flength_file)){ if($handle = opendir($temp_upload_dir)){ while(false !== ($file_name = readdir($handle))){ if(($file_name != '.') && ($file_name != '..') && ($file_name != $flength_file)){ $read_status->bytes_uploaded += filesize($temp_upload_dir . '/' . $file_name); $read_status->uploaded_files++; } } closedir($handle); $read_status->active = 1; if($read_status->uploaded_files > 0){ $read_status->uploaded_files -= 1; } } else{ $read_status->open_dir_error = 1; } } else{ $read_status->is_dir_error = 1; } return $read_status; }
This is very good example for read image uploading bytes.
You can use this example - I am preferring to you.