Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 更新时文件上载不会移动到文件夹中_Javascript_Php_Jquery_Html_Css - Fatal编程技术网

Javascript 更新时文件上载不会移动到文件夹中

Javascript 更新时文件上载不会移动到文件夹中,javascript,php,jquery,html,css,Javascript,Php,Jquery,Html,Css,代码如下: <?php if(isset($_POST['update'])) { extract($_POST); $filename = $_FILES['uni_image']['name']; $path = "uni_banner/"; $move=move_uploaded_file($_FILES['uni_image']['tmp_name'],$path.$_FILES['uni_image']['name

代码如下:

<?php 

   if(isset($_POST['update']))
    {
      extract($_POST);
      $filename = $_FILES['uni_image']['name'];
      $path = "uni_banner/";
      $move=move_uploaded_file($_FILES['uni_image']['tmp_name'],$path.$_FILES['uni_image']['name']);
      $filename2 = $_FILES['logo']['name'];
      $path2 = "uni_logo/";
      $move=move_uploaded_file($_FILES['logo'['tmp_name'],$path2.$_FILES['logo']['name']);

      $sql = "update all_university set university_name='$university_name',uni_type='$uni_type',short_name='$short_name',courses='$courses',address='$address',city='$city',phone='$phone',website='$website',facilities='$facilities',courses_fee='$fee',about_us='$about_us',field='$field',priority='$priority',short_name='$short_name',state='$state',form_fee='$form_fee',university_commission='$university_commission',client_commission='$client_commission',form_type='$form_type',logo='$filename2',uni_image='$filename' where university_id='".$university_id."'"; 
      $corr=mysqli_query($link,$sql);
      if ( $corr === true)
        {
          echo "<script type= 'text/javascript'>alert(' Record Update successfully');</script>"; 
        }
      else
        {
           echo "<script type= 'text/javascript'>alert('Error');</script>";
        }
   }
?>

<input type="file" name="logo" id="logo">
<input type="file" name="uni_image" id="uni_image">
<input type="submit" name="update" id="update">

尝试使用表单中的所有输入以及有效的操作和方法

<form action="file_path_of_upload_script.php" method="post" enctype="multipart/form-data">
<input type="file" name="logo" id="logo">
<input type="file" name="uni_image" id="uni_image">
<input type="submit" name="update" id="update">
</form>

// 并在上传过程中检查文件夹权限和有效文件夹路径

尝试改变这一点

$move=move_uploaded_file($_FILES['logo']['tmp_name'],$path2.$_FILES['logo']['name']);
你的html部分应该是

<form method="post" enctype="multipart/form-data">
<input type="file" name="logo" id="logo">
<input type="file" name="uni_image" id="uni_image">
<input type="submit" name="update" id="update">
</form>


代码中有错误吗?在更新查询中使用的所有其他数据(如地址、uni_类型等)从哪里获得?您应该真正使用,而不是串联查询。
<form method="post" enctype="multipart/form-data">
<input type="file" name="logo" id="logo">
<input type="file" name="uni_image" id="uni_image">
<input type="submit" name="update" id="update">
</form>