-2
我想插入图片到MSSQL提供用户选项来选择图像并将其插入database.so MSSQL我用下面的代码插入图片到使用PHP
<html>
<head>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
mmysql_connect("localhost","sample","welcome");
mysql_select_db("samples");
if (empty($_POST["frm"]))
{
}
else
{
$filename=trim($_REQUEST['slcfile']);
$datastring = file_get_contents($filename);
$data = unpack("H*hex", $datastring);
echo trim($_REQUEST['slcfile']);
mssql_query("insert into imageinserter values (0x".$data['hex'].",'.$filename.')");
}
}
?>
</head>
<body>
<form name="frm" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post" >
select image :<input type="file" name="slcfile" /> <br>
<input type="submit" name="slcfile" value="addimage"/>
</form>
</body>
</html>
但跟它在的file_get_contents错误错误说没有找到这样的文件或资源。 请帮助解决这个问题提前
感谢
我是否需要添加multipart/form-data? – 2013-03-26 10:24:38
方法名称后 – 2013-03-26 10:26:11
我是新来的PHP和html.so请告诉我什么属性,我需要给在窗体中的价值。 – 2013-03-26 10:31:07