'要修改的名称'}.${EXT},lblinfo.Text = "文件上传成功

 应用     |      2020-03-26 00:28

用Replace Pioneer来批量改名。

 

 

 

 

<?php
require dirname(__FILE__).'/include/Inc.php';
require dirname(__FILE__).'/include/Sys_session.php';
require dirname(__FILE__).'/include/Upload_fun.php';

命令:
${BASE}{replace,'原名称','要修改的名称'}.${EXT}

 

$uptypes=array(
'image/jpg',
'image/jpeg',
'image/png',
'image/pjpeg',
'image/gif',
'image/bmp',
'image/x-png'
);
$_filepaths   = Replace_Text($_POST["filepaths"]);
$_EditName    = Replace_Text($_POST["EditName"]);
$_FormName    = Replace_Text($_POST["FormName"]);
$_PPID        = Replace_Text($_POST["PPID"]);
$_act         = Replace_Text($_POST["act"]);
$max_file_size=2000000; //上传文件大小限制, 单位BYTE
$destination_folder=$_filepaths; //上传文件路径
$watermark=1; //是否附加水印(1为加水印,其他为不加水印);
$watertype="img"; //img代表以图片方式,text代表以文字方式添加水印
$waterposition=7; //(1为左下角,2为右下角,3为左上角,4为右上角,5为居中);
竞博体育app下载 ,$waterstring="0917e.com"; //水印字符串
$TextColor  ="";  //水印颜色
$fontType  ="";  //水印字体
$waterimg="images/LOGO.png"; //水印图片
$cls_ftp=0;

举例:
“高清.rmvb”转换为“移动高清.rmvb”

protected void Button1_Click(object sender, EventArgs e)
{
if (this.uploadfile.PostedFile.FileName.Equals(""))
{
return;
}
else
{
string _flag = Request["flag"];
string _regex = "";

if ($_act == 'uploadfile')

步骤:

switch (_flag)
{
case "img":
_regex = @"^.+.(jpe?g|gif)$";
break;
case "flash":
_regex = @"^.+.(swf)$";
break;
case "media":
_regex = @"^.+.(wmv|avi|rmvb|mpeg|mov)$";
break;
case "file":
_regex = @"^.+.(rar|zip|doc|pdf|txt)$";
break;
default:
_regex = @"^.+.(jpe?g|gif|swf|wmv|avi|rmvb|mpeg|mov|rar|zip|doc|pdf|txt)$";
break;
}

{
if (!is_uploaded_file($_FILES["file1"][tmp_name]))
//是否存在文件
{
echo "图片不存在!";
exit;
}

竞博体育app下载 1

Regex test = new Regex(_regex);

$file = $_FILES["file1"];
if($max_file_size < $file["size"])
//检查文件大小
{
echo "文件太大!";
exit;
}
if(!in_array($file["type"], $uptypes))
//检查文件类型
{
echo "文件类型不符!".$file["type"];
exit;
}
if(!file_exists($destination_folder))
{
mkdir($destination_folder);
}
$filename=$file["tmp_name"];
$image_size = getimagesize($filename);
$pinfo=pathinfo($file["name"]);
$ftype=$pinfo['extension'];
$destination = $destination_folder.time().".".$ftype;
if (file_exists($destination) && $overwrite != true)
{
echo "同名文件已经存在了";
exit;
}
if(!move_uploaded_file ($filename, $destination))
{
echo "移动文件出错";
exit;
}
$pinfo=pathinfo($destination);
$fname=$pinfo[basename];
//echo " <font color=red>已经成功上传</font><br>文件名: <font color=blue>".$destination_folder.$fname."</font><br>";
//echo " 宽度:".$image_size[0];
//echo " 长度:".$image_size[1];
//echo "<br> 大小:".$file["size"]." bytes";

1.点击中间的“batch runner”图标;

if (test.IsMatch(uploadfile.PostedFile.FileName) == true)
{
ClientScriptManager cs = Page.ClientScript;

if($watermark==1) {
setWater($destination_folder.$fname,$waterimg,$waterstring,$TextColor,$waterposition,$fontType,$watertype);
}

 

string imagesfolder = ConfigurationManager.AppSettings["imagesfolder"].ToString();
string filename = Common.UpLoadFile(uploadfile, imagesfolder);
string apurl = Request.Url.ToString();
string apurl2 = Request.CurrentExecutionFilePath;
string tempurl = apurl.Substring(0, apurl.IndexOf(apurl2));
string appurl = Request.ApplicationPath;
string hurl;
if (appurl.Length == 1)
hurl = appurl + filename.Replace("~/", "");
else
hurl = "/" + filename.Replace("~/", "");
hurl = hurl.Replace("路径1", "路径2");
string imgpreview = tempurl + hurl;
imgpreview = imgpreview.Replace("路径1", "路径2");

if($cls_ftp==1){
$picname=$destination_folder.$fname;
$cls_ftp_path=$fname;
$ftp_server="FTP地址"; 
$con=ftp_connect($ftp_server); 
ftp_login($con,"username","password"); 
$tempstate=ftp_put($con,$cls_ftp_path,$picname,FTP_BINARY);//以二进制方式上传文件 
if($tempstate){ 
//unlink删除www服务器上的图片当然也可以保留 

 

cs.RegisterClientScriptBlock(this.GetType(), "tt", "parent.document.all('divProcessing').style.display='none';parent.document.all('d_width').value='550';parent.document.all('d_height').value='341';parent.document.all('imgPreview').src='"

echo "<table width='100%' border='0' cellspacing='0' cellpadding='0'>";
echo "<tr>";
echo "<td valign='middle' align='center'>" ;
echo ("<img src='images/suss.gif' />");
echo ("<span style=' margin:auto;font-family:Verdana, Geneva, sans-serif; font-size:16px; color:#900;'><br>上传成功请不要修改上传好的图片地址</span>");
echo "</td>";
echo "</tr>";
echo "</table>";
}else{ 
echo "上传未成功";
exit();
}
ftp_quit($con);//
}

 

  • imgpreview + "';parent.document.all('Hurl').value='" + hurl + "';parent.document.all('d_fromurl').value='';", true);

echo "<table width='100%' border='0' cellspacing='0' cellpadding='0'>";
echo "<tr>";
echo "<td valign='middle' align='center'>" ;
echo ("<img src='images/suss.gif' />");
echo ("<span style=' margin:auto;font-family:Verdana, Geneva, sans-serif; font-size:16px; color:#900;'><br>上传成功请不要修改上传好的图片地址</span>");
echo "</td>";
echo "</tr>";
echo "</table>";
}

竞博体育app下载 2

lblinfo.Text = "文件上传成功!<a href="">重新上传</a>";
}
else
{
lblinfo.Text = "您上传的文件类型不正确!<a href="">重新上传</a><script>parent.document.all('divProcessing').style.display='none';</script>";
}
}
}

_close();
?>
<script language="javascript">
var dg = frameElement.lhgDG;

竞博体育app下载 3

   window.onload=function()
{

2.在弹出的对话框中,单击“pick files”选项,一次性选中多个文件;

 dg.curWin.document.getElementById("pic1").value=("<?php echo $fname?>");
 dg.addBtn( 'close', '上传成功', dg.cancel );
 dg.reDialogSize(450,200);
}  

 

</script>

 

 

 

 

 

竞博体育app下载 4

3.选中“set output file name”,并且输入上面的命令;
4.选中“auto apply”;
5.选中“file rename”,处理完毕。

 

Replace Pioneer下载地址:

 

 

还有其他一些批处理的工具: