|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16161 Uploaded file corrupted
Submitted: 2002-03-19 00:45 UTC Modified: 2002-03-19 04:20 UTC
From: adeshner at mail dot dvo dot ru Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.1.2 OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: adeshner at mail dot dvo dot ru
New email:
PHP Version: OS:


 [2002-03-19 00:45 UTC] adeshner at mail dot dvo dot ru
I have PHP 4.1.2 (binary distribution from and Apache/1.3.22 Server running under Windows NT 5.0 build 2195 (Windows 2000). I have a problem:
uploaded files seem to be corrupted, namely, all bytes with values '0x0' in original file are changed to values '0x20' in uploaded one, so only binary files are corrupted, text files are OK.

Form used:

<form method="POST" action="./upload.php" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="65536">
<input name="uploadfile" type="file" size="40">
<input type="submit" value="Send">

The script is:

$tmpname=preg_replace("/\\\/", "/", $_REQUEST["uploadfile"]["tmp_name"]);
preg_match("/\..*/", $_REQUEST["uploadfile"]["name"], $match);
copy($tmpname, $tmpname . $match[0]);

Thanks for any help.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-19 04:20 UTC]
The bug system is not the appropriate forum for asking support
questions. For a list of a range of more appropriate places to ask
for help using PHP, please visit

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Oct 19 08:03:37 2021 UTC