php文件上传代码
<html>
<head><title>文件上传</title></head>
<body alink="#FF0000" link="#000099" vlink="#CC6600" topmargin="8" leftmargin="0" bgColor="#FFFFCC">
<?php
if(!$_POST['upload'])
{
?>
<form enctype="multipart/form-data" action="upload.php" method="post">
<br><br><br><br>
<table cellspacing=0 bordercolordark=#FFFFFF width="60%" bordercolorlight=#000000 bgcolor=#FFFFFF border=1 align="center" cellpadding="2">
<tr bgcolor="#6b8ba8" style="color:FFFFFF">
<td width="100%" align="center" valign="bottom" height="19" colspan="2">文 件 上 传</td>
</tr>
<tr>
<td width="30%" align="right" height="19"><font size=3>文件位置:</font></td>
<td width="70%"><input type="file" name="upload_file" size="30"></td>
</tr>
<tr>
<td width="100%" align="center" colspan="2"><input type="submit" name="upload" value="上载文件"></td>
</tr>
</table>
</form>
<?php
}else
{
$upload_file=$_FILES['upload_file']['tmp_name'];
$upload_file_name=$_FILES['upload_file']['name'];
if(empty($upload_file_name))
{?>
<script language="javascript">
window.alert("上传文件为空!请您重新选择要上传文件。");
//location.href="upload.php";
//window.history.go(-1); //-1表示返回,0表示刷新本页,1表示前进等等
window.history.back();
</script>
<?}
if($upload_file)
{
$file_size_max = 6000*6000; // 1M限制文件上传最大容量(bytes)
$store_dir = "d:/"; // 上传文件的储存位置(可以任意修改为您要上传位置)
$accept_overwrite = 1;//是否允许覆盖相同文件
// 检查文件大小
if ($upload_file_size > $file_size_max)
{
echo "对不起,你的文件容量大于规定";
exit;
}
// 检查读写文件
if (file_exists($store_dir . $upload_file_name) && !$accept_overwrite) {
Echo "存在相同文件名的文件";
exit;
}
//复制文件到指定目录
if (!move_uploaded_file($upload_file,$store_dir.$upload_file_name))
相关文档:
经过2个星期的艰苦奋斗,终于小有成就。详细的流程我之前也有说过。所以不再提出。直接上代码,希望对大家有所帮助。
1.LOGIN.php
<?php
include_once"conn2.php";
$uname=$_POST['uname'];//接收传过来的用户名
$upwd=$_POST['upwd'];//接收传过来的密码并md5()
$sql="SELECT * from pv_master WH ......
PHP中的MYSQL常用函数总结
1、mysql_connect()-建立数据库连接
格式:
resource mysql_connect([string hostname [:port] [:/path/to/socket] [, string username] [, string password]])
例:
$conn = @mysql_connect("localhost", "username", "password") or dir( ......
原帖地址:http://www.phpma.com/english/20071215/640.html
Description
array explode
( string separator, string string [, int limit])phpma.com
Returns an array of strings, each of which is a substring of string
formed by splitting it on boundaries formed by the string separator
. If limit
is ......
测试:http://www.yincode.com
用户:test1 test2 test3
密码:123456
=======================================
2010/01/12/18:54:24
=======================================
谷歌浏览器浏览不正常
main.js
function getData(u,m,callBack){
var ru=u+"&r="+Math.random();
$(" ......
编译安装php5.2.0时出错解决方案
1.错误信息...................如下
checking for mcrypt support... no
checking for mhash support... no
checking whether to include mime_magic support... no
checking for MING support... no
checking for mSQL support... no
checking for MSSQL support via FreeTDS ......