doudouchan5830 2010-02-23 07:59
浏览 55

奇怪的PHP文件上传问题

I am having strange issues regarding file upload on my windows system. I am using windows 7 with iis7 on the server. I am trying on a client comp with local IP 10.47.47.13 and the server is 10.47.47.1.

I have a very simple form which i couldn't make it work in some cases. The page stays on the wwwroot. (http://10.47.47.1/3.php)

3.php

<?php
 $source_file=$_FILES["newsimg"]["tmp_name"];   
 $destination_file="123.jpg";
 $ftp_server="localhost";
 $ftp_username="admin";
 $ftp_password="apple";

  if ($source_file!="") {
    $mrph_connect = ftp_connect($ftp_server,21);
    $mrph_login= ftp_login($mrph_connect, $ftp_username, $ftp_password);   
    if (($mrph_connect) && ($mrph_login)) {
      $upload = ftp_put($mrph_connect, $destination_file, $source_file, FTP_BINARY);
      if ($upload) echo "ok"; else echo "nok";
    }
  }

?>

<body>
<form enctype="multipart/form-data" action="3.php" method="POST">
  <input type=file  name=newsimg>
  <input type=submit name=mrph>
</form>
</body>

The form calls itself to upload the file. When I select a file of size 1 or 2 KB it works but when I select a file of even 10 15KB the page timeouts after some time. I checked the php.ini settings file upload is on, I set temp folder as c:\uploads just to test. AS I SAID IT WORKS FOR FILES SIZE 1 OR 2KB BUT NOT EVEN WHEN I SELECT A FILE OF 10 OR 20KB. I even removed the PHP code (commented everything) to see even when nothing is done it works but it didn't.

Any help would be appreciated.

  • 写回答

5条回答 默认 最新

  • douchungu0859 2010-02-23 08:08
    关注

    To me, the problem seems to be where you are uploading your file, the server; there is nothing wrong with uploading because you are able to upload smaller files but when you upload files of 20 kb size, you fail, check to make sure that right upload settings are specified on the server you want to upload the file to. Using ftp and uploading to a different server/location itself is slow process though. Your code also seems to be right.

    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大