你是指enctype="multipart/form-data"?
这个肯定是写了的

解决方案 »

  1.   

    刚才在整理代码,现在贴出来,大家帮我看看吧
    ---------------------------------------------------------------------------
    <script language='javascript'>
    function upload()
    {
        var fileObj = document.getElementById('fileuploader');
        if (fileObj == null)
        {
    var filetag = "<input type='file' style='visibility:hidden' name='fileuploader' id='fileuploader' onchange='showattach();'>";
    fileObj = document.createElement(filetag);
    uploaderDiv.appendChild(fileObj);
        }
        fileObj.click();
        return;
    }function showattach()
    {
        var fobj = document.getElementById('fileuploader');
        if(fobj != null)
        {
    var fullpath = fobj.value;
    var ind = fullpath.lastIndexOf("\\");
    var filename = fullpath.substring(ind+1, fullpath.length); var fileNameTag = "<span id='filenamelink'>";
    var fileOpTag = "<span id='fileoplink' onclick='deleteAttach()' style='color:#68a5ea;cursor:hand'>"; var fileNameObj = document.createElement(fileNameTag);
    var fileOpObj = document.createElement(fileOpTag);
    var attachArea = document.getElementById('attachinfo');
    attachArea.appendChild(fileNameObj);
    attachArea.appendChild(fileOpObj); fileOpObj.innerText = " 删除";
    fileNameObj.innerText = filename;
    return;
        }
    }
    function deleteAttach()
    {
        // delete file uploader
        var oChild = uploaderDiv.children(0);
        uploaderDiv.removeChild(oChild);    // delete upload file info
        oChild = attachinfo.children(0);
        attachinfo.removeChild(oChild);
        oChild = attachinfo.children(0); 
        attachinfo.removeChild(oChild);}
    function submitform()
    {
        document.forms[0].submit();}
    </script><form name='form1' id='form1' action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
    ...
    <div id="uploaderDiv" style="display:none"></div> // 用来append fileuploader
    ...
    <div id='attachinfo' name='attachinfo'></div> // 用来append已添加附件名
    ...
    <span onclick='upload()' style='text-decoration:underline;cursor:hand'>附件</span> // 添加附件的按钮
    ...
    <input id='btnok' type='button' value='确定' onclick='submitform();'> // 提交按钮
    ...
    </form>
    ---------------------------------------------------------------------------