它应该将文件移动到新目录,但它不起作用。它适用于我的旧托管网站,但不再适用:
<?php
if (isset($_post['submit']))
{
$myVariable = $_POST['pdf'];
$pdf = $myVariable;
$users = '/Users/';
$proc = '/processed/';
$sourc = '/uploaded/';
}
$host = "";
$user3 = "";
$db_name= "";
$pass= "";
$con = mysql_connect($host, $user3, $pass);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("db490855420", $con);
$agent=($_POST['agentname']);
$desc=($_POST['desc']);
$date=($_POST['date']);
$pdf=($_POST['pdf']);
$sql = "INSERT INTO `db490855420`.`documets` (`agentname`, `description`, `date`, `filename`, `numb`) VALUES ('$agent', '$desc', '$date', '$pdf', '1');";
if (!mysql_query($sql,$con)) {
die('Error: ' . mysql_error());
}
mysql_close($con);
$origsource = ($users.$_SESSION['username'].$sourc.$pdf);
$newsource = ($users.$_SESSION['username'].$proc.$pdf);
$srcfile= ($users.$_SESSION['username'].$sourc.$pdf);
$dstfile= ($users.$_SESSION['username'].$proc.$pdf);
copy($srcfile, $dstfile);
unlink($srcfile);
?>
发布到数据库就好了,但它只是没有将它移动到新文件夹。是的,路径存在