DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14031>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14031

POST handling for multi part forms incorrect

           Summary: POST handling for multi part forms incorrect
           Product: Apache httpd-1.3
           Version: 1.3.27
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Other
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


I recently upgraded one of my RedHat7.1 servers running apache 1.3.20 to
Redhat8.0 running Apache 1.3.26 and then 1.3.27 and I discovered that previously
good PHP code no longer worked. The code was simple file upload code for a multi
part form with a form element input="file". The POST data just didn't seem to
come through to the PHP code. I tried the same thing on a Redhat7.3 box running
apache 1.3.26 and then 1.3.27 and I got the same problem. As soon as I put the
same code back on version 1.3.20 on another server it worked first time. the
following is the code which I used to discover the problem.


<HTML>
<HEAD><TITLE>Store binary data into SQL Database</TITLE></HEAD>
<BODY>

<?php

if ($upload) {

    // connect to the database
    // (you may have to adjust the hostname,username or password)

$db = mysql_connect("192.168.x.x","foo","bar"); mysql_select_db("graphic",$db);

@copy("$formdata","./tempfile.jpg");

$size = GetImageSize("./tempfile.jpg");

if ($size[0] < $size[1]){
$dataupright = "1";
}
else {
$dataupright = "0";
}

    $data = addslashes(fread(fopen($formdata, "r"), filesize($formdata)));

    $result=MYSQL_QUERY("INSERT INTO binary_data
(bin_data,file_name,file_size,file_type,dataupright) ".
        "VALUES
('$data','$formdata_name','$formdata_size','$formdata_type','$dataupright')");
    $id= mysql_insert_id();
?>
Please use the following tag to use this graphic.<br>
<b>&lt;img src="getpicture.php?id=<?php echo $id?>"&gt;</b><br>
<?
    MYSQL_CLOSE();
} else {
?>
    <form method="post" action="uploadgraphic.php" 
enctype="multipart/form-data">
    <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000000">
    <br>File to upload/store in database:<br>
    <input type="file" name="formdata"  size="40">
    <input type="hidden" name="upload" value="work please">
    <p><input type="submit" name="submit" value="submit">
    </form>
<?php
}
?>
</BODY>
</HTML>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to