图像上传到blob不起作用

时间:2014-05-13 02:34:47

标签: php html mysql

我的格式为

<input name="image" type="file" />

这是在php

$actorsex = mysqli_real_escape_string($connect, $_POST['ActorSex']);
$actoraccent = mysqli_real_escape_string($connect, $_POST['ActorAccent']);
$language = mysqli_real_escape_string($connect, $_POST['Language']);
$logo = addslashes(file_get_contents($connect, $_FILES['image']['tmp_name']));
$aftereffects = mysqli_real_escape_string($connect, $_POST['AfterEffects']);

$sql="INSERT INTO orders (name, email, website, phone, companyname, productservice,                        voiceover, videowritten, targetcustomer, productsolve, featurebenefit, briefoutline,   productbenefit, videoideas, calltoaction, actorsex, actoraccent, language, logo,   aftereffects)
VALUES ('$name', '$email', '$website', '$phone', '$companyname', '$productservice', '$voiceover', '$videowritten', '$targetcustomer', '$productsolve', '$featurebenefit', '$briefoutline', '$productbenefit', '$videoideas', '$calltoaction', '$actorsex', '$actoraccent', '$language', '$logo', '$aftereffects')";

还有更明显但我不想淹没屏幕。图像数据没有传递到数据库,是的,徽标列是一个中等颜色(我知道这不是黄金方式,但它是我需要它为这个项目完成的。)

提前致谢!

1 个答案:

答案 0 :(得分:0)

你为什么要通过$ connect?

$logo = addslashes(file_get_contents($connect, $_FILES['image']['tmp_name']));

应该是:

$logo = addslashes(file_get_contents($_FILES['image']['tmp_name']));

您是否考虑过存储图片的路径?如果是这样,你应该提一下为什么它不是一种选择。