荫尝试使用PHP和MySQL插入文件夹中的图像,但图像不是在文件夹中的数据库 存储以及这是我的PHP代码图像不使用PHP和MYSQL
if(isset($name)) {
$pass = base64_encode($pass);
$cpass = base64_encode($cpass);
$image_name = $_FILES['image']['name'];
$image_temp = $_FILES['image']['tmp_name'];
$image_type = $_FILES['image']['type'];
if ($image_type == 'image/png' || $image_type == 'image/jpg' || $image_type == 'image/iso' || $image_type = 'image/gif') {
$upload = move_uploaded_file('uploads1/' . $_FILES['image']['name']);
if($upload) {
$reg_query = mysqli_query($conn, "INSERT INTO `quiz_register`(`name`, `email`, `mobile`, `password`, `cpassword`, `image`) VALUES ('$name','$mail','$cell','$pass','$cpass','$image_name')");
if ($reg_query) {
echo 'success';
} else {
echo 'fail';
}
}
}
}
这是我的HTML代码
<form method="post" action="" enctype="multipart/form-data">
<input type="text" name="name" placeholder="name" class="form-control" id="name"> <br>
<input type="email" name="mail" placeholder="[email protected]" class="form-control" id="mail"> <br>
<input type="text" name="mobile" placeholder="Mobile" class="form-control" id="mobile"> <br>
<input type="password" name="password" placeholder="password" class="form-control" id="password"> <br>
<input type="password" name="cpassword" placeholder="confirm-password" class="form-control" id="cpassword"> <br>
<input type="file" name="image" id="file" class="form-control" required> <br>
</form>
此代码对你有帮助 – 2017-04-01 06:38:18
我想你的代码,但是当IAM插入,图像列显示quiz_register表空白,其余的值将除了图像 –
在其中输入IMAGE_NAME您使用$ filepath1我是更新我的代码 – 2017-04-01 06:59:50