php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10487 Uploaded files get prepended with 'Content-Type: ...' string
Submitted: 2001-04-25 05:28 UTC Modified: 2001-04-25 12:27 UTC
From: t at nymand dot dk Assigned:
Status: Closed Package: HTTP related
PHP Version: 4.0.4pl1 OS: Linux RedHat 7.0
Private report: No CVE-ID: None
 [2001-04-25 05:28 UTC] t at nymand dot dk
<HTML>
<BODY>
<?php

define(MAX_SIZE, 1000000);
define(UPLOAD, 0);
define(SUBMIT, 1);

function upload() {
        global $PHP_SELF;

        printf ("<form method=\"post\" ENCTYPE=\"multipart/form-data\" action=\"%s?action=%d&person_id=%d\">\n",
                $PHP_SELF,SUBMIT,$person_id);
        print ("File:<BR> <INPUT TYPE=FILE NAME=\"pictfile\" SIZE=50><BR>");
        print ("<input type=\"submit\" name=\"button\">\n");
        printf ("</form>\n");
}
 
function submit($file) {
        $fd=fopen($file,"r") or die ("Unable to open uploaded file!");
        $data=fread($fd, MAX_SIZE);
        fclose($fd);
        unlink($file);
        echo "Beginning of file: ".substr($data, 0, 25);
}
 
 
if (empty($action))
        $action = UPLOAD;
 
switch ($action) {
case UPLOAD:
        upload();
        break;
case SUBMIT:
        submit($pictfile);
        break;
default:
        die ("Unknown action code ($action)");
}
 
?>
</body>
</html>                                                           

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-25 12:26 UTC] rasmus@php.net
This has been fixed in CVS and will be part of 4.0.5
See bug #9298
 [2001-04-25 12:27 UTC] rasmus@php.net
Fixed in CVS - will be in 4.0.5
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Oct 22 13:01:29 2019 UTC