php无法从tmp移动文件

时间:2014-12-02 10:17:33

标签: php html wordpress

我遇到了一个简单的PHP代码,它必须将上传的文件从tmp移动到所需的位置。请在下面找到我的代码。我不确定我哪里出错了。 任何帮助表示赞赏。

php代码:

<?php
define("UPLOAD_DIR", "/srv/www/wordpress/mywebpage/uploads/");
   $scr = $_FILES["jb_cv"]["tmp_name"];
   $desttmp = $_FILES["jb_cv"]["name"];
     $dest =  UPLOAD_DIR .$desttmp;

      echo " source file : ";
      echo $scr."\t";
    echo " destination file : ";
    echo $dest;

   $success = move_uploaded_file($scr,$dest);   

    if (!$success) {
        echo "<p>Unable to save file.</p>";             
        exit;
    } 
?> 

HTML code:

<html>
    <head>
    <title>Form</title>
    </head>
    <body>

    <h1>Enter your name</h1>

    <form method="post" action="move.php" id="contactform" name="contactform" enctype="multipart/form-data">
                                <label> Upload your CV</label> <input name="jb_cv" type="file" />                        
                                    <input  type="submit" value="SUBMIT" />


    </form>

    </body>
    </html

0 个答案:

没有答案