无法将文件上传到服务器

时间:2014-09-07 07:33:02

标签: php upload

我正在尝试在服务器上传文件,但我收到的错误是我的代码,任何人都可以告诉我为什么我的代码没有上传,它显示There was an error uploading the file, please try again!因为我在代码中回应这个,.thanks

<form method="post" name="myForm" action="processForm.php">

    <div class="grid_6 omega flr"><p style="margin:-39px 0 0;"> Upload CV: 
                            <input type="file" name="uploadedfile" id="uploadedfile" style="margin:-25px 0 0 74px;height:30px;"  />
                            </p>
                            </div>
</form>

我的processForm.php

<?php

$dbHost = 'localhost'; // usually localhost
$dbUsername = 'xxxxx';
$dbPassword = 'xxxxx';
$dbDatabase = 'xxxxxxnew';
$db = mysql_connect($dbHost, $dbUsername, $dbPassword) or die ("Unable to connect to Database Server.");
mysql_select_db ($dbDatabase, $db) or die ("Could not select database.");

$target_path = "/var/www/cms/cv/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

//print $target_path; 

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
    " has been uploaded";
} else{
    echo "There was an error uploading the file, please try again!";
}
?>

0 个答案:

没有答案