【发布时间】:2009-10-01 17:33:35
【问题描述】:
在下面的 HTML 页面上放置一个文本框的最佳方法是什么?无需重新加载页面,当用户单击按钮时,在 PHP 中获取其内容?
<?php require_once "phpuploader/include_phpuploader.php" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Simple File Upload - use SaveDirectory property</title>
<link href="demo.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="demo">
<h2>Attach some files</h2>
<p>Attach some files using the button below.</p>
<ul>
<li>Allowed file types is set to: jpg, gif, png, zip
- multiple files (Max 10M)</li>
</ul>
<?php
$uploader=new PhpUploader();
$uploader->MultipleFilesUpload=true;
$uploader->InsertText="Upload Now";
$uploader->MaxSizeKB=10240;
$uploader->AllowedFileExtensions="jpeg,jpg,gif,png,zip";
$uploader->SaveDirectory="savefiles";
$uploader->Render();
?>
</div>
</body>
</html>
我知道我可以使用表单和帖子,但我想留在同一页面上。
【问题讨论】:
-
如果您需要服务器端的东西,请寻找 ajax,否则寻找 javascript