您的位置:首页 > 编程语言 > PHP开发

php 上传文件。$_FILES

2014-03-08 11:34 393 查看
<form name="article" method="post"  enctype="multipart/form-data" action="<?php echo $this->createUrl('/guoarticle/file'); ?>">
<table width="829" height="206" border="1">
<tr>
<td width="97">新闻标题:</td>
<td width="616"><input type="text" name="newname"/></td>
</tr>
<tr>
<td>图片:</td>
<td><input type="file" name="file"/></td>
</tr>
<tr><td><input type="submit" value="提交"/></td></tr>
</table>
</form>




上面是html 代码,下边是 php 代码。

<?PHP

echo "<pre>";
print_r($_POST);
var_dump($_FILES);


结果为:

Array
(
[newname] => ff
)
array
'file' =>
array
'name' => string 'a4.jpg' (length=6)
'type' => string 'image/jpeg' (length=10)
'tmp_name' => string 'D:\wamp\tmp\php122.tmp' (length=22)
'error' => int 0
'size' => int 106987
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: