2011 本站教學範例已全面更新~ 新教學請看 http://www.flycan.com/article/   【到新的教學討論區】
【飛肯設計學苑】- 回首頁 -
回首頁最新開課訊息企業包班教育訓練範例教學區問題討論區交流分享區程式下載區
Photoshop影像達人專修班 Photoshop 遮色片 & 色版創作進階班 CSS 版面設計專修班 ActionScript 3.0 程式設計入門班 ActionScript & XML 進階整合應用班 Dreamweaver & CSS網頁版型設計班

 

本站已全面更新~ 2011年 新教學範例請看 → http://www.flycan.com/article/

 

【DW PHP 資料庫】問題討論區
PHP_upload.mxp檔案上傳的問題....

發表新主題   回覆主題
【飛肯】教學網站 首頁 » 【DW PHP 資料庫】問題討論區
上一篇主題 :: 下一篇主題  
發表人 內容
peggyccc
【新生】
【新生】


註冊時間: 2007-10-18
文章: 1

發表PHP_upload.mxp檔案上傳的問題.... 引言回覆

發表於: 2007-10-19 11:37 
為何我用這做好PHP_upload.mxp檔案上傳的功能,卻不能檔案上傳呢?

<?php

// ---------------------------------------------

// Pure PHP Upload version 1.1

// -------------------------------------------

if (phpversion() > "4.0.6") {

$HTTP_POST_FILES = &$_FILES;

}

define("MAX_SIZE",300000);

define("DESTINATION_FOLDER", "./images");

define("no_error", "upload_success.php");

define("yes_error", "upload_error.php");

$_accepted_extensions_ = "jpg";

if(strlen($_accepted_extensions_) > 0){

$_accepted_extensions_ = @explode(",",$_accepted_extensions_);

} else {

$_accepted_extensions_ = array();

}

$_file_ = $HTTP_POST_FILES['file'];

if(is_uploaded_file($_file_['tmp_name']) && $HTTP_POST_FILES['file']['error'] == 0){

$errStr = "";

$_name_ = $_file_['name'];

$_type_ = $_file_['type'];

$_tmp_name_ = $_file_['tmp_name'];

$_size_ = $_file_['size'];

if($_size_ > MAX_SIZE && MAX_SIZE > 0){

$errStr = "File troppo pesante";

}

$_ext_ = explode(".", $_name_);

$_ext_ = strtolower($_ext_[count($_ext_)-1]);

if(!in_array($_ext_, $_accepted_extensions_) && count($_accepted_extensions_) > 0){

$errStr = "Estensione non valida";

}

if(!is_dir(DESTINATION_FOLDER) && is_writeable(DESTINATION_FOLDER)){

$errStr = "Cartella di destinazione non valida";

}

if(empty($errStr)){

if(@copy($_tmp_name_,DESTINATION_FOLDER . "/" . $_name_)){

header("Location: " . no_error);

} else {

header("Location: " . yes_error);

}

} else {

header("Location: " . yes_error);

}

}

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=big5">

<title>無標題文件</title>

</head>

<body>

<form name="form1" enctype="multipart/form-data" method="post" action="">

<p>

<input type="file" name="file">

</p>

<p>

<input type="submit" name="Submit" value="送出">

</p>

</form>

</body>

</html>

回頂端
檢視會員個人資料 發送私人訊息
從之前的文章開始顯示:   
發表新主題   回覆主題     1頁(共1頁)
【飛肯】教學網站 首頁 » 【DW PHP 資料庫】問題討論區

 
所有的時間均為 台北時間 (GMT + 8 小時)
前往:  

回首頁】【最新開課訊息】【企業委訓】【範例教學分享區】【問題討論區