需要帮助上面的代码是将图像保存到上面代码中定义的文件夹(照片)中。但是表单发布的其他数据没有保存到数据库中...我是 php 新手,我从网站 www.jeasyui.com 找到了这段代码。所以我尝试修改它但失败..像往常一样.:(
if (!isset($_FILES['image']['tmp_name'])) {
echo "";
}else{
$file=$_FILES['image']['tmp_name'];
$image= addslashes(file_get_contents($_FILES['image']['tmp_name']));
$image_name= addslashes($_FILES['image']['name']);
move_uploaded_file($_FILES["image"]["tmp_name"],"photos/" . $_FILES["image"]["name"]);
$location="photos/" . $_FILES["image"]["name"];
$name = $_REQUEST['prname'];
$code = $_REQUEST['prcode'];
$type = $_REQUEST['prtype'];
$weight = $_REQUEST['prweight'];
$desc = $_REQUEST['prdesc'];
$machine = $_REQUEST['prmachinemodel'];
include 'conn.php';
$sql = "insert into canon (product_name,product_code,product_type, product_descp, product_weight, machine_model, location) values('$name','$code','$type','$desc',$weight','$machine','$location')";
$result = @mysql_query($sql);
if ($result){
echo json_encode(array('success'=>true));
} else {
echo json_encode(array('msg'=>'Some errors occured.'));
}}?>