php上传文件功能 [英] php upload file function
本文介绍了php上传文件功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我点击提交没有反应。
file:upload_form.html
<!DOCTYPE html PUBLIC - // W3C // DTD XHTML 1.0 Transitional // ENhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> ;
< html xmlns =http://www.w3.org/1999/xhtml>
< head>
< meta http-equiv =Content-Typecontent =text / html; charset = utf-8/>
< title>无标题文档< / title>
< / head>
< body>
< form action =do_upload.phpmethod =postenctype =multipart / form-data>< / form>
< p>< strong>要上传的文件< / strong>< / p>
< p>< input name =img1type =filesize =30/>< / p>
< p>< input name =submittype =submitvalue =Upolad File/>< / p>
< / body>
< / html>
file:do_upload.php
<$ p $如果($ _FILES [img1]!={
@copy($ _ FILES [img1] [tm_name],/ tmp)$ p $
<?php
。$ $ _ $ b或die(不能复制文件);
} else {
die(no file specified);
}
$>
$ b< HTML>
< head>
< title>成功文件上传< / title>
< / head>
< body>
< h1>成功< / h1>
< p>您发送了:< ;? echo $ _FILES [img1] [name];?> ;< ;? echo $ _FILES [img1] [size];?> byte MIME类型的MIME类型< ;? echo $ _FILES [img1] [type];?>< / p>