简体   繁体   English

用于在另一台服务器上上传文件的 PHP 相同脚本不起作用

[英]PHP same script for Uploading file on another server is not working

I have simple PhP script that is working fine on one of my server but when i placed it on my another server and it's not working.我有一个简单的 PhP 脚本,它在我的一台服务器上运行良好,但是当我将它放在另一台服务器上时却无法正常工作。 What can be the possible reason for it... Here is my script可能的原因是什么......这是我的脚本

<?php
  $objFile = & $_FILES["file"];
  $strPath = basename( $objFile["name"] );
  $fname =  $_POST["fname"];

  if( move_uploaded_file( $objFile["tmp_name"], $strPath ) ) {
    print "The file " .  $strPath . " has been uploaded. my vavirable name is ".$fname;
   } else {
    print "There was an error uploading the file, please try again!";
    } 

Echo this fields and find what is printed.回显此字段并查找打印的内容。

echo $_FILES["file"]["name"];
echo $_FILES["file"]["tmp_name"];

I think there is a space between & and $_FILES["file"];我认为 & 和 $_FILES["file"]; 之间有一个空格; be a problem.成为问题。

$objFile = & $_FILES["file"];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM