Taken straight from fread manual page: http://www.php.net/manual/en/function.fread.php
Edited to remove the loop..
<?php
$handle = fopen("http://www.example.com/", "rb");
$contents = fread($handle, 1696);
fclose($handle);
?>
Pregunta
My PHP application involves selecting certain parts of an uploaded file and storing them in my database for easy retrieval. What I need to do is get everything between 0x0
and 0x6A0
(1696 bytes) and store them in the database. It includes binary characters like NUL
and I'm a bit worried about sanitisation without ruining the file.
I need to do this while making sure that the first 8 bytes of the file are 50 41 52 41
.
Solución
Taken straight from fread manual page: http://www.php.net/manual/en/function.fread.php
Edited to remove the loop..
<?php
$handle = fopen("http://www.example.com/", "rb");
$contents = fread($handle, 1696);
fclose($handle);
?>