大侠求助!From提交上传图片白屏,哪里出问题了呀?
<form method="post" autocomplete="off" id="articleform" action="time.php?mod=showhandle&op=gotoplay" enctype="multipart/form-data">
<table width="100%" border="0" align="left">
<tr>
<th colspan="2" scope="col" align="left">
姓名:<font color="#FF0000">*</font><input type="text" class="px p_fre" id="name" name="name" value="$arrUsers[name]"/>
</th>
</tr>
<tr>
<th colspan="2" scope="col" align="left">
年龄:<font color="#FF0000">*</font>
<select id="age" name="age">
<option value="0">保密</option>
<!--{loop $_G['age'] $value}-->
<option value="$value" <!--{if $arrUsers[age] == $value}-->selected="selected"<!--{/if}-->>$value</option>
<!--{/loop}-->
</select>
</th>
</tr>
<tr>
<th colspan="2" scope="col" align="left">
身高:<font color="#FF0000">*</font>
<select id="stature" name="stature">
<option value="0">保密</option>
<!--{loop $_G['stature'] $value}-->
<option value="$value" <!--{if $arrUsers[stature] == $value}-->selected="selected"<!--{/if}-->>$value</option>
<!--{/loop}-->
</select></th>
</tr><tr>
<td colspan="2">
星座:<font color="#FF0000">*</font><select id="constellation" name="constellation">
<option value="保密">保密</option>
<option value="白羊座" <!--{if $arrUsers[constellation] == '白羊座'}-->selected="selected"<!--{/if}-->>白羊座</option>
<option value="金牛座" <!--{if $arrUsers[constellation] == '金牛座'}-->selected="selected"<!--{/if}-->>金牛座</option>
<option value="双子座" <!--{if $arrUsers[constellation] == '双子座'}-->selected="selected"<!--{/if}-->>双子座</option>
<option value="巨蟹座" <!--{if $arrUsers[constellation] == '巨蟹座'}-->selected="selected"<!--{/if}-->>巨蟹座</option>
<option value="狮子座" <!--{if $arrUsers[constellation] == '狮子座'}-->selected="selected"<!--{/if}-->>狮子座</option>
<option value="处女座" <!--{if $arrUsers[constellation] == '处女座'}-->selected="selected"<!--{/if}-->>处女座</option>
<option value="天秤座" <!--{if $arrUsers[constellation] == '天秤座'}-->selected="selected"<!--{/if}-->>天秤座</option>
<option value="天蝎座" <!--{if $arrUsers[constellation] == '天蝎座'}-->selected="selected"<!--{/if}-->>天蝎座</option>
<option value="蛇夫座" <!--{if $arrUsers[constellation] == '蛇夫座'}-->selected="selected"<!--{/if}-->>蛇夫座</option>
<option value="射手座" <!--{if $arrUsers[constellation] == '射手座'}-->selected="selected"<!--{/if}-->>射手座</option>
<option value="摩羯座" <!--{if $arrUsers[constellation] == '摩羯座'}-->selected="selected"<!--{/if}-->>摩羯座</option>
<option value="双鱼座" <!--{if $arrUsers[constellation] == '双鱼座'}-->selected="selected"<!--{/if}-->>双鱼座</option>
</select>
</td>
</tr><tr>
<td colspan="2">
兴趣:<font color="#FF0000">*</font><input type="text" name="interest" id="interest" value="$arrUsers[interest]" class="px p_fre"/></td>
</tr>
<tr>
<td colspan="2">
职业:<font color="#FF0000">*</font><input type="text" name="work" id="work" value="$arrUsers[work]" class="px p_fre"/></td>
</tr>
<tr>
<td colspan="2">
报时:<font color="#FF0000">*</font>
<select id="clocktime" name="clocktime" >
<!--{loop $arrweibaoshitime $key $value}-->
<option value="$key" <!--{if $iTime == $key}-->selected="selected"<!--{/if}-->>$value</option>
<!--{/loop}-->
</select>
</select> 
(可参与的时间段)
</td>
</tr><tr>
<td colspan="2">
上传照片:<input type="file" class="pf" name="pic" id="pic" value="$arrUsers[pic]" size="18">
</td>
</tr>
<tr>
<td colspan="2">
帖子链接:<input type="text" name="url" id="url" value="$arrUsers[url]" class="px p_fre"/><font color="#FF0000">(即点击照片后的链接地址)</font>
</td>
</tr><tr>
<td colspan="2">&nbsp;</td></tr> <tr>
<td colspan="2"><button type="button" id="articlebutton" class="pn pnc" name="articlebutton" onclick="validate(this);"><strong>提交</strong></button>&nbsp;&nbsp;
<button type="button" id="cancel" class="pn pnc" name="cancel" onclick="hideWindow('$_G[gp_handlekey]');"><strong>取消</strong></button>&nbsp;&nbsp;<font color="#FF0000">信息提交后请等待工作人员审核!</font>
<input type="hidden" id="txt_id" name="txt_id" value="$arrUsers[id]">
<input type="hidden" name="addsubmit" value="true" />
<input type="hidden" name="formhash" value="{FORMHASH}" /></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td></tr> 
</table>
</form>php代码部分if ($mod == 'showhandle' && $op == 'gotoplay')
{

if(submitcheck("addsubmit",0, 0, 0)) {

$old_id = $_POST['txt_id'];
$name = $_POST['name'];
$age = $_POST['age'];
$stature = $_POST['stature'];
$constellation = $_POST['constellation'];
$interest = $_POST['interest'];
$work = $_POST['work'];

$clocktime = $_POST['clocktime']; $setarr = array(
'uid' => $uid,
'username' => $username,
'name' => $name,
'age' => $age,
'stature' => $stature,
'constellation' => $constellation,
'interest' => $interest,
'work' => $work,
'addtime' => $curDatetime,
'clocktime' => $clocktime,
'state' => 2,
'baoshistate' => 1,  ); if($_FILES['pic']['name']) {
/*if($files = pic_upload($_FILES['pic'], 'profile', 580, 450, 2)) {
if ($_POST['old_pic']) {
$goods_pic_thumb = $_POST['old_pic'].".thumb.jpg";
}
pic_delete($_POST['old_pic'], 'profile', $goods_pic_thumb, 0);*/
$setarr['pic'] = "data/attachment/profile/".$files['pic'].".thumb.jpg";
/*}else 
{
$setarr['pic'] = $_POST['old_pic'];
}*/
}else 
{
showmessage("请上传照片","time.php");
}
if ($old_id) {
$result = DB::update('egbaba_clock_users',$setarr," id = $old_id ");
}else 
{
$result = DB::update('egbaba_clock_users',$setarr," clocktime = '$clocktime' ");
}


showmessage('提交成功,请等待工作人员审核!', "time.php");
}
PHP图片

解决方案 »

  1.   

    if ($mod == 'showhandle' && $op == 'gotoplay')
    {
        if(submitcheck("addsubmit",0, 0, 0)) {请确认这两个表达式成立
      

  2.   

    打印出来 $_FILES['pic']看下数据对不对
      

  3.   

    打印了就到这
    if($_FILES['pic']['name']) {
    if($files = pic_upload($_FILES['pic'], 'profile', 580, 450, 2)) {
    if ($_POST['old_pic']) {
    $goods_pic_thumb = $_POST['old_pic'].".thumb.jpg";
    }
    pic_delete($_POST['old_pic'], 'profile', $goods_pic_thumb, 0);
    $setarr['pic'] = "data/attachment/profile/".$files['pic'].".thumb.jpg";
    }else 
    {
    $setarr['pic'] = $_POST['old_pic'];
    }
    }else 
    {
    showmessage("请上传照片","time.php");
    }
    if ($old_id) {
    $result = DB::update('egbaba_clock_users',$setarr," id = $old_id ");
    }else 
    {
    $result = DB::update('egbaba_clock_users',$setarr," clocktime = '$clocktime' ");
    }


    showmessage('提交成功,请等待工作人员审核!', "time.php");
    }
      

  4.   

    是不是屏蔽错误了?在最顶加 ini_set('display_errors','on');然后 加以下两句看看有什么。
    echo 'ok';
    if($_FILES['pic']['name']) {
    echo $_FILES['pic']['name'];
      

  5.   

    这代码 貌似是DZ的吧
    需要加载DZ的类才能用
    require_once libfile('discuz/upload','class');
      

  6.   

    /*if($files = pic_upload($_FILES['pic'], 'profile', 580, 450, 2)) {
                    if ($_POST['old_pic']) {
                        $goods_pic_thumb = $_POST['old_pic'].".thumb.jpg";
                    }
                    pic_delete($_POST['old_pic'], 'profile', $goods_pic_thumb, 0);*/
                    $setarr['pic'] = "data/attachment/profile/".$files['pic'].".thumb.jpg";
                /*}else 
                {
                    $setarr['pic'] = $_POST['old_pic'];
                }*/你这里的pic_upload函数在这里包含进来了么,如果没有那就要错误了,还有 pic_delete($_POST['old_pic'], 'profile', $goods_pic_thumb, 0)这个删除参数也一样,还得要判断$_POST['old_pic']是否为空值吧