move_uploaded_file不起作用 [英] move_uploaded_file Not working

查看:70
本文介绍了move_uploaded_file不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在将文件上传到数据库以及网站文件夹中时遇到问题,
即使在与远程数据库连接的情况下,它在本地也能正常工作,但是在远程网站上进行检查时却显示错误(move_uploaded_file)不在其中.

这是请检查的代码,如果您找到任何解决方案,请把解决方案发送给我.

它总是转到move_uploaded_file的其他部分.

在此先感谢


Hi,

I am getting a problem on uploading a file to database and in the website folder,
it is working fine on local even connecting with remote data base but when it checked on remote website but it show error (move_uploaded_file) not going within it.

Here is the code pls check and if you find any solution then pls send me the solution.

It always going to else part of move_uploaded_file.

Thanks in Advance


<?php
//include('mysqldbconfig.php');
session_start();
$job_title='';
$first_name='';
$last_name='';
$email='';
$current_company='';
$mobile='';
 if(isset($_POST["Submit"]))
 {
$job_title=$_POST['job_title'];
$first_name=$_POST['first_name'];
$last_name=$_POST['last_name'];
$email=$_POST['email'];
$current_company=$_POST['current_company'];
$mobile=$_POST['mobile'];
 if($_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code']) )
{
$date=date("Y-m-d"." "."h:i:s");
$date1=date("Ymdhis");

 //This is the directory where images will be saved
 $docc=($_FILES['doc']['name']);
 $doc =$date1.str_replace(' ','',$docc);
 $target = "http://www.mywebsite.in/resumes/";
 $target = $target.basename($doc);

 // Connects to your Database
$conn mysql_connect($db_host,$username, $password) or die(mysql_error()) ;
 mysql_select_db($database) or die(mysql_error()) ; 

 //Writes the photo to the server
 if(move_uploaded_file($_FILES['doc']['tmp_name'],$target))
 {
 //Tells you if its all ok
 echo "<script>"."alert('Your Resume has been uploaded Successfully')"."</script>";

 /*"The file ". basename( $_FILES['doc']['name']). " has been uploaded, and your information has been added to the directory".$date."<br/>"; */


//Writes the information to the database
$sql="INSERT INTO career(job_title,first_name,last_name,email,current_company_name,contact_number,resumes,date) VALUES('$job_title','$first_name','$last_name','$email','$current_company','$mobile','$doc','$date');";
  mysql_query($sql,$conn) or die("Error in Query: " . mysql_error());

 $job_title='';
$first_name='';
$last_name='';
$email='';
$current_company='';
$mobile='';

 }
 else {
  //Gives and error if its not
  //echo "Sorry, there was a problem uploading your file.";
 
  echo "<script>"."alert('Sorry, There was a problem uploading your file.')"."</script>";

  }
 }
 else{
// echo "Sorry no data upload";
   echo "<script>"."alert('Sorry no data upload.')"."</script>";
 }
 }


 ?>

推荐答案

job_title = ' ';
job_title='';


first_name = ' ';
first_name='';


last_name = '
last_name='';


这篇关于move_uploaded_file不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆