[PHP-DEV] PHP 4.0 Bug #9844 Updated: MIME type gets added to variable using POST method From: sniper <email protected>
Date: 03/19/01

ID: 9844
Updated by: sniper
Reported By: roy <email protected>
Old-Status: Open
Status: Closed
Bug Type: *Directory/Filesystem functions
Assigned To:
Comments:

This is fixed in CVS. Try latest CVS snapshot from http://snaps.php.net/

--Jani

Previous Comments:
---------------------------------------------------------------------------

[2001-03-19 15:01:10] roy <email protected>
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 rn 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'

---------------------------------------------------------------------------

ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=9844&edit=2

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>