簡體   English   中英

在IIS 8上上傳PHP文件

[英]PHP File Upload on IIS 8

我在運行腳本以在服務器上上傳GIF圖像時遇到問題。 我正在使用Windows Server 2012和IIS8。我嘗試了在Internet上找到的所有方法,但仍無法正常工作。

在我的php.ini中,上傳溫度。 目錄 是具有完全控制權限的“ C:\\ Windows \\ Temp”。 即使對於最終目標,您在此腳本中看到的也是相同的:

if(isset($_POST['uploadform'])){
  $target_dir = "uploads/";
  $target_file = $target_dir . basename($_FILES["userfile"]["name"]);
  $nomefile = $_FILES["userfile"]["name"];
  $uploadOk = 1;
  $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
  print_r($_FILES);
  // Check file size
  if ($_FILES["userfile"]["size"] > 15000000) {
    echo "Too big.";
    $uploadOk = 0;
  }

  // Check if $uploadOk is set to 0 by an error
  if ($uploadOk == 0) 
    echo "Sorry, your file was not uploaded.";
   else // if everything is ok, try to upload file
  if (move_uploaded_file($_FILES["userfile"]["tmp_name"], $target_file)) 
    header("LOCATION: ". WEB ."/ok.php");
}

我沒有與此代碼。 在php.ini中,啟用了文件上傳功能,但沒有任何顯示。 你可以幫幫我嗎?

非常感謝!

HTML中存在問題-不要忘記將enctype="multipart/form-data"到文件表單中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM