我想通过此表单上传数据
<input type="file" name="upload[]" multiple="" />
我上传照片时没问题
当我向数据库插入数据时我遇到了问题
这是我的代码
for ($x = 0; $x<count($file ['name']); $x++){
$imgname = $file ['name'] [$x] ;
$imgsize = $file['size'] [$x];
$imgtmpname = $file['tmp_name'] [$x];
$imgtype = $file['type'] [$x];
$size = 6000000;
$imgtypes = array('image/jpeg','image/gif','image/png');
$new_name_time = time();
$new_name_rand = rand(0000,9999);
$new_name_md5 = md5($new_name_time);
create_image($imgtmpname, 'files/'.$new_name, $newwidth, $newheight);
$pics[$x] = $new_name;
} // end for
$newdata = (implode("','", $pics));
$insert = $mysqli->query("INSERT INTO msgs
(id, yourname, msgmail, msgname, msg, pics) VALUE
('', '$yourname', '$msgmail', '$msgname', '$msg', '$newdata')");
if($insert) {
echo '<div class="msgok">done</div>';
}
答案 0 :(得分:0)
尝试替换
$newdata = (implode("','", $pics));
带
$newdata = (implode(',', $pics));
这应该有效