php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24574 File corruption during file upload
Submitted: 2003-07-10 01:02 UTC Modified: 2003-07-10 10:24 UTC
From: ivan at artenergy dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.3.2 OS: FreeBSD 4.7/Apache1.3.27
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ivan at artenergy dot com
New email:
PHP Version: OS:

 

 [2003-07-10 01:02 UTC] ivan at artenergy dot com
Description:
------------
Uploading files, e.g. JPGs or GIFs, using HTML form/PHP interface results in corrupted files.

Reproduce code:
---------------
HTML form fragment:
...
<form method="post" enctype="multipart/form-data" action="update.php"><input type="file" name="image">
....

update.php fragment:
...
copy("$image", "/www/image/$image_name") or die("Couldn't upload $image_name !");
...

Expected result:
----------------
Selected local file uploaded to the web server as 
"/www/image/$image_name"

Actual result:
--------------
File is indeed uploaded, file length is correct, but it is
corrupted. 
Typically all 0x00 bytes are replaced with 0x20.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-10 10:24 UTC] sniper@php.net
See bug #11066 (and search the bug database next time BEFORE you submit any reports)

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 30 01:01:28 2024 UTC