Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Date: Sat, 27 Jul 2013 17:34:23 +0200 From: Luuk User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 Newsgroups: comp.lang.php,comp.datbase.mysql Subject: Re: is mysqli_real_escape_string bullet proof with binary data? References: <7gucca-oqm.ln1@luuk.invalid.lan> <775dca-t9p.ln1@luuk.invalid.lan> In-Reply-To: <775dca-t9p.ln1@luuk.invalid.lan> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Lines: 23 NNTP-Posting-Host: 2001:980:9089:1:8966:4a16:a859:b517 X-Trace: 1374939302 news.xs4all.nl 15899 [2001:980:9089:1:8966:4a16:a859:b517]:58628 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.php:10248 Even if i add the following function: function fwrite_stream($fp, $string) { for ($written = 0; $written < strlen($string); $written += $fwrite) { $fwrite = fwrite($fp, substr($string, $written)); if ($fwrite === false) { return $written; } } return $written; } and at the end of my code: $fp = fopen('NewUpArrow.png','wb'); fwrite_stream($fp, $file); Then i can see that i created a copy of the original file: luuk@opensuse:~> diff -s upArrow.png NewUpArrow.png Files upArrow.png and NewUpArrow.png are identical