致命错误函数必须是一个字符串

时间:2016-06-21 16:31:15

标签: php mysql database image-upload

public DBConnection.Bill Bill { get; set; }

public Bill_Overview(DBConnection.Bill bill)
{
    InitializeComponent();
    Bill = bill;
    DataContext = bill;
}

我在这里已经创建了一个表单,并试图上传当我上传的图片时,我试图显示上传的图片,显示有一个致命的错误函数必须是一个字符串

<?php
    if(isset($_POST['submit'])){


        mysql_connect('localhost','root','');
        $con_db=mysql_select_db('test');

        if(!$con_db)echo"Error Connecting";

        $imageName = mysql_real_escape_string($_FILES['image']['name']);
        $imageData = mysql_real_escape_string(file_get_contents($_FILES['image']['tmp_name']));
        $imageType = mysql_real_escape_string($_FILES['image']['type']);

        echo $imageName;


        if(substr($imageType,0,5)=="image"){
            mysql_query('insert into image values("","$imageData","imageName")');
        }
        else echo "Select Image to Post";
    }
?>
<body>
    <form action="" method="post" enctype="multipart/form-data">
        <table>
            <td><tr>Upload image</tr><td><input type="file" name="image"></td>
            <td><tr></tr><tr><input type="submit" name="submit"></tr></td>

        </table>

这是另一个显示图像的php文件

0 个答案:

没有答案