<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>庆亮的博客-webgame架构 &#187; 表单生成</title>
	<atom:link href="http://www.qingliangcn.com/tag/%e8%a1%a8%e5%8d%95%e7%94%9f%e6%88%90/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.qingliangcn.com</link>
	<description>关注LAMP&#124;PHP源代码分析&#124;web架构&#124;PHP扩展&#124;Erlang&#124;服务端架构</description>
	<lastBuildDate>Fri, 10 Jun 2011 04:10:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>表单生成类NdUploadForm</title>
		<link>http://www.qingliangcn.com/2007/04/%e8%a1%a8%e5%8d%95%e7%94%9f%e6%88%90%e7%b1%bbnduploadform/</link>
		<comments>http://www.qingliangcn.com/2007/04/%e8%a1%a8%e5%8d%95%e7%94%9f%e6%88%90%e7%b1%bbnduploadform/#comments</comments>
		<pubDate>Tue, 10 Apr 2007 05:57:48 +0000</pubDate>
		<dc:creator>庆亮</dc:creator>
				<category><![CDATA[暂未分类]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[表单]]></category>
		<category><![CDATA[表单生成]]></category>

		<guid isPermaLink="false">http://www.nd21.com/wordpress/?p=35</guid>
		<description><![CDATA[&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; 系统环境：Windows XP SP2 + php 5.2.1 + mysql 5.0 + Apache 2.2.24 开发环境：Zend Studio 5.5 参数： safe_mode = Off error_reporting = E_ALL &#038; ~E_NOTICE register_globals =Off magic_quotes_runtime = Off &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; 可以和之前发的php上传类配合使用，我一起发上来。 Demo代码： NdForm]]></description>
			<content:encoded><![CDATA[<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>系统环境：Windows XP SP2 + php 5.2.1 + mysql 5.0 + Apache 2.2.24<br />
开发环境：Zend Studio 5.5<br />
参数： safe_mode = Off<br />
         error_reporting  =  E_ALL &#038; ~E_NOTICE<br />
         register_globals =Off<br />
         magic_quotes_runtime = Off</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<span id="more-35"></span></p>
<pre lang="php">

<?php
/**
*
* @package NDNotebook
* @version $Id: NdUploadForm.php,v 1.0.0 2007/04/02 00:04:24 xm.zhuge Exp $
* @copyright (c) 2007 Nandou Studio
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @thanks : XUpload
*/

class NdUploadForm
{
 var $nd_formheader;
 var $nd_formend;
 var $nd_formmaxFileSize;

 function NdUploadForm($uptofile="upload.php", $method = "post", $maxfilesize = "1024 * 1024")
 {
   $this->nd_formheader = '
<form method="'.$method.'" enctype="multipart/form-data" action="'.$uptofile.'">';
   $this->nd_formmaxFileSize = $maxfilesize;
   $this->nd_formend = '</form>

';
 }

 function appendInput($type, $name, $value)
 {
   $tmp = '
<input type="'.$type.'" '.'name="'.$name.'" value="'.$value.'">';
   echo $tmp."\n";
 }

 function formHeader()
 {
   echo $this->nd_formheader."\n";
 }

 function formMaxSize()
 {
   $size = '
<input type="hidden" name="MAX_FILE_SIZE" value="'.$this->nd_formmaxFileSize.'">';
   echo $size."\n";
 }

 function formEnd()
 {
   echo $this->nd_formend."\n";
 }
}
?>
</pre>
<p>    可以和之前发的php上传类配合使用，我一起发上来。</p>
<pre lang="php">
 Demo代码：

<?php
error_reporting(E_ALL &#038; ~E_NOTICE);
require_once('class/NdUpload.php');
require_once('class/NdUploadForm.php');
$max_filesize = 1024 * 1024;
$arr_filetype = array('.zip','.rar','.jpg','.gif','.bmp','.doc');

extract($_POST);
if (isset($upfile) &#038;&#038; $upfile == 'upfile')
{
 $file = $_FILES['file']['tmp_name'];
 $file_name = $_FILES['file']['name'];
 $file_size = $_FILES['file']['size'];

 $upfile = new NdUpload();
 $upfile->setDir('./upload/');
 $upfile->copyFile();
 $upfile->showError();
}

?>
<html>
<head>
<META http-equiv=Content-Type content="text/html; charset=utf-8">

</head>

<body>
<?php
$form = new NdUploadForm('test.php', "post", $max_filesize);
$form->formHeader();
$form->appendInput("file", "file", "浏览");
$form->appendInput("hidden", "upfile", "upfile");
$form->formMaxSize();
$form->appendInput("submit", "submit", "上传");
$form->formEnd();
?>

</body>
</html>
</pre>
<p><a href='http://www.nd21.com/wordpress/wp-content/uploads/2009/07/1176213157_0.rar'>NdForm</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.qingliangcn.com/2007/04/%e8%a1%a8%e5%8d%95%e7%94%9f%e6%88%90%e7%b1%bbnduploadform/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>


