提交表单时出现未定义索引错误

时间:2019-09-24 13:28:32

标签: php mysql

我正在为申请人创建一个新的简历门户。当我提交表单时,它给了我一个语法错误:

  

注意:未定义的索引:第6行的C:\ Xampp \ outsource_page \ careers_open \ upload_cv \ index.php中的my_file

在正常运行之前,现在出现了意外错误。

代码如下:

<?php 
//Error reporting manupilation
//error_reporting(0);

//Upload the cv and store in the cv file
if (($_FILES['my_file']['name']!="")){

  // Where the file is going to be stored
  $target_dir = "upload/";
  $file = $_FILES['my_file']['name'];
  $path = pathinfo($file);
  $filename = $path['filename'];
  $ext = $path['extension'];
  $temp_name = $_FILES['my_file']['tmp_name'];
  $path_filename_ext = $target_dir.$filename.".".$ext;


  // Check if file already exists
  if (file_exists($path_filename_ext)) {
    echo "Sorry, file already exists.";
  } else {
    move_uploaded_file($temp_name,$path_filename_ext);

    echo "<table><td>Please Note</td></table>";
    echo '<br/>';
    echo "Congratulations! We got your cv sucessfully, within 48 hours we will get back to you soon";
    echo '<br/>';
    echo "If you are qualified we will contact you over the number you sent us";
  }
}
?>


<table style="#"> 
 <th> <h1>Upload yopur CV down here </h1> </th>
 <tr>
    <td> 
    <form name="form" method="post" action="upload.php" enctype="multipart/form-data" >
    <input type="text" class="input_style" name="name" placeholder="Enter your good name" /><br>
    <input type="email" class="input_style" name="email" placeholder="Email address we can contact you"/><br>
    <input type="contact" class="input_style" name="contact" placeholder="Your personal Contact no"/><br>
    <hr/>
    <input type="file" name="my_file" /><br /><br>
    <input type="submit" name="submit" value="Upload"/>
    </form> 
    </td>
 </tr>
</table>

0 个答案:

没有答案