2013年2月18日 星期一

上傳檔案簡易版

創建 FILE UPLOAD



Create The Upload Script


if ($_FILES["file"]["error"] > 0){
    echo "Error: " . $_FILES["file"]["error"] . "";
  }else{
    echo "Upload: " . $_FILES["file"]["name"] . "";
    echo "Type: " . $_FILES["file"]["type"] . "";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB";
    echo "Stored in: " . $_FILES["file"]["tmp_name"];
  }


$_FILES["file"]["name"] - the name of the uploaded file
$_FILES["file"]["type"] - the type of the uploaded file
$_FILES["file"]["size"] - the size in kilobytes of the uploaded file
$_FILES["file"]["tmp_name"] - the name of the temporary copy of the file stored on the server
$_FILES["file"]["error"] - the error code resulting from the file upload

沒有留言: