请高手给段代码,使上传图片后的名字更改为系统时间 都懒到什么程度了啊?参考 手册中的move_uploaded_file函数自己写 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 请帮帮忙,我这有上传图片的代码,只是不知道该怎样上传后把图片的名字改成系统时间.<?php// Pure PHP Upload 2.1.2if (isset($HTTP_GET_VARS['GP_upload'])) { $ppu = new pureFileUpload(); $ppu->path = "../../upload"; $ppu->extensions = ""; $ppu->formName = "form1"; $ppu->storeType = "file"; $ppu->sizeLimit = "300"; $ppu->nameConflict = "uniq"; $ppu->requireUpload = "false"; $ppu->minWidth = ""; $ppu->minHeight = ""; $ppu->maxWidth = ""; $ppu->maxHeight = ""; $ppu->saveWidth = ""; $ppu->saveHeight = ""; $ppu->timeout = "600"; $ppu->progressBar = "blueFlashProgress.htm"; $ppu->progressWidth = "300"; $ppu->progressHeight = "100"; $ppu->checkVersion("2.1.2"); $ppu->doUpload();}$GP_uploadAction = $HTTP_SERVER_VARS['PHP_SELF'];if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { if (!eregi("GP_upload=true", $HTTP_SERVER_VARS['QUERY_STRING'])) { $GP_uploadAction .= "?".$HTTP_SERVER_VARS['QUERY_STRING']."&GP_upload=true"; } else { $GP_uploadAction .= "?".$HTTP_SERVER_VARS['QUERY_STRING']; }} else { $GP_uploadAction .= "?"."GP_upload=true";}function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue;}$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];}if (isset($editFormAction)) { if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { if (!eregi("GP_upload=true", $HTTP_SERVER_VARS['QUERY_STRING'])) { $editFormAction .= "&GP_upload=true"; } } else { $editFormAction .= "?GP_upload=true"; }}if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO photo_cn (Name_ph, DateTime_ph, Kfgj_ID_ph) VALUES (%s, %s, %s)", GetSQLValueString($HTTP_POST_VARS['Name_ph'], "text"), GetSQLValueString($HTTP_POST_VARS['DateTime_ph'], "text"), GetSQLValueString($HTTP_POST_VARS['Kfgj_ID_ph'], "int")); mysql_select_db($database_kfgj_cn, $kfgj_cn); $Result1 = mysql_query($insertSQL, $kfgj_cn) or die(mysql_error()); $insertGoTo = "ok.php"; if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo));}mysql_select_db($database_kfgj_cn, $kfgj_cn);$query_Recordset1 = "SELECT ID_kf FROM kfgj_cn ORDER BY ID_kf DESC";$Recordset1 = mysql_query($query_Recordset1, $kfgj_cn) or die(mysql_error());$row_Recordset1 = mysql_fetch_assoc($Recordset1);$totalRows_Recordset1 = mysql_num_rows($Recordset1);?> <?$rt="no";if($UploadAction=="yes"){ $Filepath="../web/brandpic/"; //上载文件存放路径 $FileName=$Filepath.$Upfile_name; $str=explode(".",$Upfile_name); $pname=date("Ymdhis"); $FileName1=$Filepath.$pname.".".$str[1]; $UploadAction=0; $TimeLimit=60; /*设置超时限制时间默认时间为 30s,设置为0时为不限时 */ //set_time_limit($TimeLimit); If(($Upfile != "none")&&($Upfile != "")) { $Filepath="../web/brandpic/"; //上载文件存放路径 $FileName=$Filepath.$Upfile_name; if(!file_exists($FileName)) { switch ($str[1]): case "gif": $rt='yes'; break; case "GIF": $rt='yes'; break; case "jpg": $rt='yes'; break; case "JPG": $rt='yes'; break; case "jpeg": $rt='yes'; break; case "JPEG": $rt='yes'; break; endswitch; if ($rt!='yes') { echo '文件格式非法,不能上载'; exit();} if(copy($Upfile,$FileName1)) {unlink($Upfile); $photo=$pname.".".$str[1]; echo "<br><br>\n"; echo "文件 $Upfile_name 已上载成功!"; echo "<br><br>\n"; } else {echo "文件 $Upfile_name上载失败!"; } }echo "上传成功";}else{echo "你没有选择任何文件上载!"; }exit(); //恢复默认超时设置}?><table width="490" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#5c7fc6"> <tr> <td width="34" height="28" align="center"> </td> <td width="566"><font color="white">添 加 服 装 品 牌</font></td> </tr></table><table width="490" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#5c7fc6"> <tr> <td width="668" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr bgcolor="#eef7ff"> <td height="17" bgcolor="#eef7ff"> </td> </tr> </table> <table width="488" border="0" cellspacing="1" cellpadding="2"> <FORM ENCTYPE = "multipart/form-data" ACTION = "" METHOD = "POST" name="brandadd" ><INPUT TYPE = "hidden" NAME = "MAX_FILE_SIZE" VALUE ="1000000"><INPUT TYPE = "hidden" NAME = "UploadAction" VALUE = "yes"> <tr> <td height="25" align="center" bgcolor="#dfeeff">品牌标志<br>(小图片)</td> <td colspan="3"> <input name="Upfile" type="file" id="smallpic" size="25"> 图片大小:120X60像素 </td> </tr> <tr> <td colspan="4" align="center" background="../img/line_bgh.gif"></td> </tr> <tr> <td height="30" colspan="4" align="center"><input type="submit" name="Submit" value="提交"> <input type="reset" name="Submit" value=" 清 除 "></td> </tr></form> </table> </td> </tr></table><div align="center"> <table width="490" border="0" cellpadding="6" cellspacing="0" bgcolor="#FFFFFF"> <tr> <td height="48"> </td> </tr> </table></div> extjs问题 ,求高手来。。。本人刚接触,求解 求JavaScript+JQuery视频 看看这个效果怎么实现的 菜鸟级别女生请教大家:JSP中判断空值的方法 iframe怎么得到我当前页的参数再传递到另一个页面中? Date如何比较相等关系 突然发现这简单的问题还真不懂 如何给自己页面加保护 Object方式include htm文件闪烁问题,急!急!急! 框架页面的跳转! 高分请教关于网站的维护的方式 请问怎样用javascript取得一个元素呢?
// Pure PHP Upload 2.1.2
if (isset($HTTP_GET_VARS['GP_upload'])) {
$ppu = new pureFileUpload();
$ppu->path = "../../upload";
$ppu->extensions = "";
$ppu->formName = "form1";
$ppu->storeType = "file";
$ppu->sizeLimit = "300";
$ppu->nameConflict = "uniq";
$ppu->requireUpload = "false";
$ppu->minWidth = "";
$ppu->minHeight = "";
$ppu->maxWidth = "";
$ppu->maxHeight = "";
$ppu->saveWidth = "";
$ppu->saveHeight = "";
$ppu->timeout = "600";
$ppu->progressBar = "blueFlashProgress.htm";
$ppu->progressWidth = "300";
$ppu->progressHeight = "100";
$ppu->checkVersion("2.1.2");
$ppu->doUpload();
}
$GP_uploadAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
if (!eregi("GP_upload=true", $HTTP_SERVER_VARS['QUERY_STRING'])) {
$GP_uploadAction .= "?".$HTTP_SERVER_VARS['QUERY_STRING']."&GP_upload=true";
} else {
$GP_uploadAction .= "?".$HTTP_SERVER_VARS['QUERY_STRING'];
}
} else {
$GP_uploadAction .= "?"."GP_upload=true";
}function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}if (isset($editFormAction)) {
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
if (!eregi("GP_upload=true", $HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "&GP_upload=true";
}
} else {
$editFormAction .= "?GP_upload=true";
}
}if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO photo_cn (Name_ph, DateTime_ph, Kfgj_ID_ph) VALUES (%s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['Name_ph'], "text"),
GetSQLValueString($HTTP_POST_VARS['DateTime_ph'], "text"),
GetSQLValueString($HTTP_POST_VARS['Kfgj_ID_ph'], "int")); mysql_select_db($database_kfgj_cn, $kfgj_cn);
$Result1 = mysql_query($insertSQL, $kfgj_cn) or die(mysql_error()); $insertGoTo = "ok.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}mysql_select_db($database_kfgj_cn, $kfgj_cn);
$query_Recordset1 = "SELECT ID_kf FROM kfgj_cn ORDER BY ID_kf DESC";
$Recordset1 = mysql_query($query_Recordset1, $kfgj_cn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
$rt="no";if($UploadAction=="yes")
{
$Filepath="../web/brandpic/"; //上载文件存放路径
$FileName=$Filepath.$Upfile_name;
$str=explode(".",$Upfile_name);
$pname=date("Ymdhis");
$FileName1=$Filepath.$pname.".".$str[1];
$UploadAction=0;
$TimeLimit=60;
/*设置超时限制时间默认时间为 30s,设置为0时为不限时 */
//set_time_limit($TimeLimit);
If(($Upfile != "none")&&($Upfile != ""))
{
$Filepath="../web/brandpic/"; //上载文件存放路径
$FileName=$Filepath.$Upfile_name;
if(!file_exists($FileName))
{ switch ($str[1]):
case "gif":
$rt='yes';
break;
case "GIF":
$rt='yes';
break;
case "jpg":
$rt='yes';
break;
case "JPG":
$rt='yes';
break;
case "jpeg":
$rt='yes';
break;
case "JPEG":
$rt='yes';
break;
endswitch;
if ($rt!='yes')
{ echo '文件格式非法,不能上载';
exit();}
if(copy($Upfile,$FileName1))
{unlink($Upfile);
$photo=$pname.".".$str[1];
echo "<br><br>\n";
echo "文件 $Upfile_name 已上载成功!";
echo "<br><br>\n";
}
else
{echo "文件 $Upfile_name上载失败!";
}
}
echo "上传成功";}
else
{echo "你没有选择任何文件上载!";
}
exit(); //恢复默认超时设置
}
?><table width="490" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#5c7fc6">
<tr>
<td width="34" height="28" align="center"> </td>
<td width="566"><font color="white">添 加 服 装 品 牌</font></td>
</tr>
</table>
<table width="490" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#5c7fc6">
<tr>
<td width="668" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr bgcolor="#eef7ff">
<td height="17" bgcolor="#eef7ff"> </td>
</tr>
</table>
<table width="488" border="0" cellspacing="1" cellpadding="2">
<FORM ENCTYPE = "multipart/form-data" ACTION = "" METHOD = "POST" name="brandadd" >
<INPUT TYPE = "hidden" NAME = "MAX_FILE_SIZE" VALUE ="1000000">
<INPUT TYPE = "hidden" NAME = "UploadAction" VALUE = "yes">
<tr>
<td height="25" align="center" bgcolor="#dfeeff">品牌标志<br>(小图片)</td>
<td colspan="3">
<input name="Upfile" type="file" id="smallpic" size="25">
图片大小:120X60像素
</td>
</tr>
<tr>
<td colspan="4" align="center" background="../img/line_bgh.gif"></td>
</tr>
<tr>
<td height="30" colspan="4" align="center"><input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit" value=" 清 除 "></td>
</tr></form>
</table>
</td>
</tr>
</table>
<div align="center">
<table width="490" border="0" cellpadding="6" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td height="48"> </td>
</tr>
</table>
</div>