Bug #10487: Uploaded files get prepended with 'Content-Type: ...' string
| From: | t at nymand dot dk | Date: | Wed, 25 Apr 2001 09:28:53 +0000 |
| Subject: | Bug #10487: Uploaded files get prepended with 'Content-Type: ...' string | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-52371@lists.php.net to get a copy of this message | ||
From: t@nymand.dk
Operating system: Linux RedHat 7.0
PHP version: 4.0.4pl1
PHP Bug Type: HTTP related
Bug description: Uploaded files get prepended with 'Content-Type: ...' string
<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>
--
Edit Bug report at: http://bugs.php.net/?id=10487&edit=1