Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/251.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 文件上载脚本不工作_Php_Html_Post_File Upload_Undefined - Fatal编程技术网

Php 文件上载脚本不工作

Php 文件上载脚本不工作,php,html,post,file-upload,undefined,Php,Html,Post,File Upload,Undefined,我有以下HTML代码用于将文件发布到我的上载脚本: <!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> <title>CONTISEC PORTAL

我有以下HTML代码用于将文件发布到我的上载脚本:

<!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>
    <title>CONTISEC PORTAL - NEW USER</title>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="buttcss/gstyle_buttons.css" type="text/css"  media="screen">
    <link rel="stylesheet" type="text/css" href="usercon.css" />
</head>

<body>

    <div id="page-wrap">



        <p>CREATE NEW CLIENT USER ACCOUNT BY ENTERTING CLIENT REFERENCE NUMBER (supplied by Pershing) AND DESIRED USERNAME.</p>





        <div id="contact-area">

            <form method="post" action="fileproc.php">
                <enctype="multipart/form-data">
                <label for="client_ref">BROWSE:</label>
                <input type="file" name="file" id="file" />
                <label for="client_ref">SELECT FILE:</label>
                <select name="file"> 
                <option value="assets" >ASSETS (DAILY)</option>
                <option value="stock_names" >STOCK_NAMES (DAILY)</option>
                <option value="client_names" >CLIENT_NAMES</option>
                </select>

                <div class="buttons">

                <button class="action redbtn" type="submit"><span class="label">SUBMIT</span></button>
            </form>

            <div style="clear: both;"></div>



        </div>

    </div>

</body>

</html>

CONTISEC门户-新用户
通过输入客户参考号(由潘兴提供)和所需用户名创建新的客户用户帐户

浏览: 选择文件: 资产(每日) 股票名称(每日) 客户名称 提交
这是我的上传脚本(来自w3学校):


但是,当页面加载时,它会显示“未定义索引”错误。
有人知道为什么会发生这种情况吗?

将以下内容添加到表单打开标记中。这是上传文件所必需的

enctype="multipart/form-data"

Sam文件选择字段和选择字段的名称相同这一定是导致问题的原因。


enctype
应该是
元素的属性,而不是元素本身。此外,select元素和文件输入都具有
name='file'
,因此
将覆盖上载文件的元数据。另外@DaveRamdom看得更近一点。它就在BROWSE的标签下:@krike是的,我在写评论后发现了它。
enctype="multipart/form-data"