<?php
require_once('../includes/upload_class.php');
$pic = $_GET["pic"];
if (isset($_GET["action"]))
{
$goback = " <a href=javascript:history.back(-1)>返 回</a>";
$upload = new class_upload();
$upload->out_file_dir = '../uploadfile';
$upload->max_file_size = '1000000';
$upload->make_script_safe = 1;
$upload->allowed_file_ext = array( 'gif', 'jpg', 'jpeg', 'png' );
$upload->upload_process();
if ( $upload->error_no )
{
switch( $upload->error_no )
{
case 1:
// No upload
print "<center>没有文件被上传".$goback."</center>";
exit();
case 2:
case 5:
// Invalid file ext
print "<center>不支持此文件格式".$goback."</center>";
exit();
case 3:
// Too big...
print "<center>文件超过上传大小".$goback."</center>";
exit();
case 4:
// Cannot move uploaded file
print "<center>上传目录设置错误".$goback."</center>";
exit();
}
}echo("<script>window.top.main.document.getElementById('{$pic}').value='{$upload->saved_upload_name1}'</script>");
echo("<script>window.top.main.document.getElementById('dialogCase').style.display='none'; </script>");
}
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>上传文件</title>
<LINK href="images/css.css" type=text/css rel=stylesheet>
</head>
<body>
<table width="100%" border="0" align="center">
<form id="form1" name="upload" enctype="multipart/form-data" method="post" action="?action=upload&pic=<?=$pic?>">
<tr>
<td align="center">请选择文件:
<input type="file" name="FILE_UPLOAD" class="input" onfocus="this.className='input1'" onblur="this.className='input2'"/></td>
</tr>
<tr>
<td align="center"> </td>
</tr>
<tr>
<td align="center"><input type="submit" name="Submit" value="上 传" class="button"/></td>
</tr></form>
</table></body>
</html>
当我点击上传是的时候,所选择的的问题就会被自动改名,并且显示出改的什么名字,然后我点击确定,所改出的名字就会传到TEXT 文本框里,听不明白的加我QQ649907230
require_once('../includes/upload_class.php');
$pic = $_GET["pic"];
if (isset($_GET["action"]))
{
$goback = " <a href=javascript:history.back(-1)>返 回</a>";
$upload = new class_upload();
$upload->out_file_dir = '../uploadfile';
$upload->max_file_size = '1000000';
$upload->make_script_safe = 1;
$upload->allowed_file_ext = array( 'gif', 'jpg', 'jpeg', 'png' );
$upload->upload_process();
if ( $upload->error_no )
{
switch( $upload->error_no )
{
case 1:
// No upload
print "<center>没有文件被上传".$goback."</center>";
exit();
case 2:
case 5:
// Invalid file ext
print "<center>不支持此文件格式".$goback."</center>";
exit();
case 3:
// Too big...
print "<center>文件超过上传大小".$goback."</center>";
exit();
case 4:
// Cannot move uploaded file
print "<center>上传目录设置错误".$goback."</center>";
exit();
}
}echo("<script>window.top.main.document.getElementById('{$pic}').value='{$upload->saved_upload_name1}'</script>");
echo("<script>window.top.main.document.getElementById('dialogCase').style.display='none'; </script>");
}
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>上传文件</title>
<LINK href="images/css.css" type=text/css rel=stylesheet>
</head>
<body>
<table width="100%" border="0" align="center">
<form id="form1" name="upload" enctype="multipart/form-data" method="post" action="?action=upload&pic=<?=$pic?>">
<tr>
<td align="center">请选择文件:
<input type="file" name="FILE_UPLOAD" class="input" onfocus="this.className='input1'" onblur="this.className='input2'"/></td>
</tr>
<tr>
<td align="center"> </td>
</tr>
<tr>
<td align="center"><input type="submit" name="Submit" value="上 传" class="button"/></td>
</tr></form>
</table></body>
</html>
当我点击上传是的时候,所选择的的问题就会被自动改名,并且显示出改的什么名字,然后我点击确定,所改出的名字就会传到TEXT 文本框里,听不明白的加我QQ649907230
然后获取文本框的值.赋给图片名称.