-1
<form name='mainform' method='post' action='do.php?ppc/workload' >
<?php
print "<input type='hidden' name='ppc_m_id' value='$id'>";
print "<table class='clean_form'>";
print "<tr><td colspan='2'><b>Attachment</b><input type='file' name='file' value=''></td></tr>";
print "<tr><td>Remarks</td><td><textarea name='sm_ppc_remarks' style='height:90;width:280'></textarea></td></tr>";
print "</table>";
?>
<input type="submit" value="submit">
</form>
</body>

做.php

class PPC extends CONTROLLER{
    function workload(){
    global $db, $auth;

        $sql['ppc_m_id'] = $_POST['ppc_m_id'];  
        $sql['ppc_remarks_sales'] = $_POST['sm_ppc_remarks'];
        $sql['ppc_sales_attachment'] = fs_upload($_FILES['file']); 

    $insert = insertformat($sql);
    $query = $db->query("insert into ppc set $insert");

    if($query)
    $db->query("update sales set sm_ppc_remarks='{$sql['ppc_remarks_sales']}', sm_sales_attachment='{$sql['ppc_dpdate']}' where sm_id='{$sql['ppc_m_id']}' limit 1");

    if($query){
    message_set('Workload has been recorded');
    goback();
    }
    }
    }

当我填写备注文本区域时,它保存在我的数据库中,但就保存附件(输入类型='文件')而言,它不保存..我不知道知道什么或缺少什么..谢谢非常

4

2 回答 2

1

<form>在标签中添加“enctype”

<form name='mainform' method='post' action='do.php?ppc/workload' enctype="multipart/form-data">
于 2012-09-07T06:45:30.280 回答
0

缺少“enctype”

<form name='mainform' method='post' action='do.php?ppc/workload' enctype="multipart/form-data">

于 2012-09-07T06:45:27.973 回答