php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9844 MIME type gets added to variable using POST method
Submitted: 2001-03-19 15:01 UTC Modified: 2001-03-19 15:17 UTC
From: roy at renaissance dot nl Assigned:
Status: Closed Package: *Directory/Filesystem functions
PHP Version: 4.0.4pl1 OS: RedHat Linux 7
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: roy at renaissance dot nl
New email:
PHP Version: OS:

 

 [2001-03-19 15:01 UTC] roy at renaissance dot nl
Every time I try to use POST to submit variables or files to a form it seems to add the mimetype to the variable. (GET seems to work fine, but then I can't upload files)

If I upload a Jpeg file, it adds "Content-Type: image/jpeg" to the variable. or if I submit a "TEXT AREA" to the script it adds "Content-Type: application/octet-stream" to the variable.

I also noticed that a normal TEXT variable gets some extra whitespace added to it in the script, so I had to use trim() to remove that.

I found a workaround for the file-upload bug somewhere :

function fix_php_upload_bug($tmp) { 
	$infile=fopen($tmp,"r"); // Open the file for the copy 
	$outfile=fopen("$tmp.new","w"); // create a new temp file 
	$header=fgets($infile,255); //get the 1st line (netscape sometimes doesn't add a Content-type line) 
	//if its more than just a \r\n sequence then 
	if (strlen($header)>2) $header=fgets($infile,255); //get next line also 
	while(!feof($infile)) { // Loop through the remaining file 
	$temp=fread($infile,128); 
	fwrite($outfile,$temp,strlen($temp)); //copying contents to new temp file 
	} 
	fclose($outfile); 
	fclose($infile); 
	copy("$tmp.new","$tmp"); //replace the original with our new bug fixed file 
	unlink("$tmp.new"); //and delete the new file 
	return filesize($tmp); //return a true file size 
	} 


Configure Command : './configure' '--prefix=/usr' '--with-config-file-path=/etc' '--disable-debug' '--enable-pic' '--enable-shared' '--enable-inline-optimization' '--with-apxs=/usr/sbin/apxs' '--with-exec-dir=/usr/bin' '--with-regex=system' '--with-gettext' '--with-gd' '--with-jpeg-dir=/usr' '--with-png' '--with-zlib' '--with-db2' '--with-db3' '--with-gdbm' '--enable-debugger' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-yp' '--enable-ftp' '--enable-wddx' '--without-mysql' '--without-oracle' '--without-oci8' '--with-xml' 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-19 15:17 UTC] sniper@php.net
This is fixed in CVS. Try latest CVS snapshot from http://snaps.php.net/

--Jani

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 00:01:30 2024 UTC