我有以下代码,但文件未在目录中上传:
<?php
include "includes/dbconn.php";
$tbl_name="finfo"; // Table name
$fname=$_POST['T1'];
$fn=$_FILES['file']['name'];
if ($_FILES["file"]["error"] > 0) {
echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
} else {
$source = $_FILES['file']['tmp_name'];
$target = "uploads/".$fn;
move_uploaded_file($source, $target);
echo $source. "<br>";
echo $target. "<br>";
echo $fn. "<br>";
}
$furl= "uploads/" . $_FILES["file"]["name"];
$fsize= (round ($_FILES["file"]["size"] / 1024)) . " kB";
$nod=0;
$sqlinsert="insert into " . $tbl_name ." (fname,furl,fsize,nod) values ('".$fname."','".$furl."','".$fsize."',".$nod.")";
$rsadd = mysql_query($sqlinsert);
if(!$rsadd) {
echo "Ehh, Something going wrong!!!!";
} else {
echo "One Record Inserted Successfully!!!";
}
?>
请不要打扰SQL,我对此没有问题..但是文件没有上传到目录中。该目录位于此 php 文件所属的同一父文件夹中。