PHP上传文件脚本

时间:2014-01-05 22:21:22

标签: php upload

固定

我的错误值为2

这是我正在使用的PHP上传脚本。允许用户无限制地上传文件。但是,某些.exe文件无法上传而其他文件正常工作。 我不确定问题是什么? (此脚本取自PHP教程)

<?php
// Where the file is going to be placed 
$target_path = "uploads/";

/* Add the original filename to our target path.  
Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 



$target_path = "uploads/upload.exe";


if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
    " has been uploaded";
    echo '<br/>';
    echo '<br/>';
    echo '<a href="http://localhost/Test/uploads/run.php">Continue</a>';

} else{
    echo "There was an error uploading the file, please try again!";
}

?>

0 个答案:

没有答案