php 上传文件。$_FILES

<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	mpphp122.tmp' (length=22)
      'error' => int 0
      'size' => int 106987
原文地址:https://www.cnblogs.com/xiaoxiao2014/p/3587699.html