dongpo7467 2011-11-28 21:43
浏览 6
已采纳

PHP文件上传,在一台机器上工作正常但在其他机器上没有?

While I was trying to uplaod file using php on windows machine its working fine :

   <form action="php/bulk.php"
  enctype="multipart/form-data" method="post">
  <p>
   Please specify a file below:<br>
  </p>
    <div>
  <input id="datafile" type="file" name="datafile" size="40"><br>
  <input type="submit" value="Upload File">
 </div></form>

code on bulk.php :

$connector = new DbConnector();
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['datafile']['name']);

if(move_uploaded_file($_FILES['datafile']['tmp_name'], $target_path)) {
  echo "The file ".  basename( $_FILES['datafile']['name']).
  " has been uploaded.  
";

} else{
echo "There was an error uploading the file, please try again!";
?>
<form action="../addsamples.php">
 <input type="submit" value="Go Back" />
</form>
<?php
    exit (-1);
}

I tried uploading on server and its not working there ! Do Operating system play any role in this ? My server is red hat linux and test m/c is windows

  • 写回答

1条回答 默认 最新

  • dongzongzi0379 2011-11-28 21:47
    关注

    The most likely problem is the file-permissions. Does the user that is running the web-server (apache I think for red hat) have write-permissions for php/uploads/?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 怎样才能让鼠标沿着线条的中心线轨迹移动
  • ¥60 用visual studio编写程序,利用间接平差求解水准网
  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?
  • ¥15 win10权限管理,限制普通用户使用删除功能
  • ¥15 minnio内存占用过大,内存没被回收(Windows环境)
  • ¥65 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?