Solved it.
I simply open the file with PHP that I want to send to the client.
$fh = fopen($filePath, 'r');
Then I calculate 60% of the filesize by writing
$fileSize = filesize($filePath);
$sizeFirst = floor(($fileSize / 100) * 60);
Now the $sizeFirst variable contains the length of the first 60% of the file, in a numeric value.
To calculate the rest 40% I use:
$sizeLast = $fileSize - $sizeFirst;
Now I can write out the first 60%, do my action, and then write outh the rest 40%.
$dataFirst = fread($fh, $sizeFirst);
echo($dataDirst);
// Do my action here.
$dataSecond = fread($fh, $sizeSecond);
echo($dataSecond);
exit();
I need to set the header(); before writing out this, the Content-length, Content-type and Content-Disposition must be set in order to send a valid header and filecontent to the client.
Hope it helps someone.