|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-03-19 15:17 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 02:00:01 2025 UTC |
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'