dongyuluan7494 2016-07-21 22:13
浏览 28

无法更新输入类型文件值

1)i am adding image and its title in database but if i submit form for first time it works but again without selecting the image when its pre selected from first submit

2) submiting form 2nd time takes image value null or is empty(updating image)

<form  method="post" enctype="multipart/form-data">
<div id="photoselect_box">
<h5 id="logo_head">Profile Image</h5>
<script>
function profile_imagee(input){
$('#profile_image')[0].src = (window.URL ? URL :webkitURL).createObjectURL(input.files[0]);
}
</script>
 //input image preview
<img src="<?php $path = "download/items/$uid/"; echo $path.$userRow['profile_image']; ?>" id="profile_image" alt="profile photo"  name="profile_image" />


<input type="file" id="img_file" name="profile_image" onChange="profile_imagee(this);"
 value="<?php echo $userRow['profile_image']; ?>" />

</div>

// i am able to update this input after clicking submit
<input type="text" id="download_content1"  name="download_content1" value="<?php echo $userRow['download_content1']; ?>" >

</form>

i cannot update the image value in database after submiting form for 2nd time php code

include_once '../../database/conn.php';
$res=mysqli_query($bd,"SELECT * FROM organisation);
$userRow=mysqli_fetch_array($res); 
$email=$userRow['email'];

if (isset($_POST['register'])){


//inserting  logo  image
$profile_image=$_FILES['profile_image']['name'];
$profile_image_temp=$_FILES['profile_image']['tmp_name'];
// changing the destination required folder according to users unique id
$path = "download/items/$uid/";
@mkdir($path, 0666, true);  // Create  upload folder.
move_uploaded_file($profile_image_temp,$path.$profile_image);



 //updating image in database
 $insert="UPDATE organisation SET profile_image= '$profile_image',download_content1 = '$download_content1 '
 WHERE email = '$email'";

$insert_pro = mysqli_query($bd,$insert);
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 python的qt5界面
    • ¥15 无线电能传输系统MATLAB仿真问题
    • ¥50 如何用脚本实现输入法的热键设置
    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100