php文件上传代码
- <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="content-type" content="text/html; charset=gb2312" />
- <title> php文件上传代码</title>
- </head>
-
- <body>
-
- <form method="post" enctype="multipart/form-data" action ="uploads.php">
- <input type = "file" name="uploadedfile" size="30">
- <input type = "hidden" name = "max_file_size" value="100000">
- <input type = "submit" value = "上传文件">
- </form>
-
- </body>
- </html>
-
-
- <?php
-
- 代码如下 复制代码
- if ($uploadedfile<>"none") {
- if (!copy($uploadedfile, "$uploadedfile_name")) {
- echo "<font face='arial' size='2'> $name 文件上传失败 ,<br>";
- echo "也可能是文件太大<br>";
- echo "请使用 back 按键再试一次";
- } else {
- echo "<font face='arial' size='2'>文件上传成功 !<br>";
- echo "文件类型:$uploadedfile_type <br>";
- echo "文件大小:$uploadedfile_size <br>";
- echo "文件名称:$uploadedfile_name <br>";
- echo "文件说明:$description <br>";
- }
- }
-
-
-
- ?>
|