【发布时间】:2016-08-19 01:20:26
【问题描述】:
我有从 php 上传文件的上传脚本,该脚本被配置为从 godaddy 上传托管服务器上的文件。我在不同的服务器域上使用的相同脚本无法在该服务器上上传,该服务器也是 Godaddy 服务器。我拥有对文件夹和服务器 ftp 的完全访问权限,但仍然不知道为什么该脚本不能在该服务器上运行。任何人都可以找出它抛出 500 错误的原因。
<?php
$ftp_server = "ftp.xxxxx.com";
$ftp_username ="xxxx@xxxx.com";
$ftp_password = "xxxxxxxxxxx";
$destination_folder = "/upload/";
$file_name = $_FILES["userfile"]["name"];
$destination_file = $destination_folder.time().'_'.$file_name;
$file = $_FILES["userfile"]["tmp_name"];
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_username, $ftp_password);
// upload a file
if (ftp_put($conn_id, $destination_file, $file, FTP_BINARY)) {
echo "successfully uploaded $file\n";
} else {
echo "There was a problem while uploading $file\n";
}
// close the connection
ftp_close($conn_id);
?>
【问题讨论】:
-
请检查错误日志。
-
我必须检查哪个错误日志??
-
你会从你的 Godaddy 服务器上找到它..
-
在 firebug 控制台中调试时出现 500 内部服务器错误。
-
让我看看我在godaddy服务器中是否发现任何错误日志......
标签: php