多个图片文件压缩成zip(rar)
通过网页上传文件都服务器
服务器解压文件并获取里面的图片数据
分成一个一个图片文件并保存能做到吗
通过网页上传文件都服务器
服务器解压文件并获取里面的图片数据
分成一个一个图片文件并保存能做到吗
解决方案 »
- c#如何对ArrayList排序?
- 请教一个对象数组to json的问题
- asp.net 2.0 treeview中,并且绑定上一些数据之后,但是如何实现点击上面字(例:山东省),展开子节点(山东省下面有济南,青岛,烟台等等...),再次点同一个字(例:山东省)时,再将其子节点折叠(山东省下面有济南,青岛,烟台等等...) .
- 数据绑定问题
- 请问如何取得程序的最后编译时间
- 关于字符串处理问题,顶有分
- 关于重组DateTable的排列顺序
- 如何获取repeater中动态添加的控件的值
- 我想遍历一个整个页面上的所有控件,而且知道每个控件是什么?(如:BT1是按钮的,当遍历到BT1时就知道它是一个按钮),应该怎样写呢?
- 请问:如何在Web应用完成之后象Winows应用程序那样打包、发布??在线等待,及时结帖!
- dropdownlist 绑定的文件显示成图像怎么实现!!!
- asp.net 传递 xml document 的问题
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using Microsoft.Win32;
using System.Runtime.InteropServices;
using System.Diagnostics;//该源码下载自www.51aspx.com(51aspx.com)
namespace TreeRar
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//递归展示文件目录
string[] dir = Directory.GetDirectories(Server.MapPath("\\"));
Response.Write("<table width=100% border=1 rules=rows cellspacing=0 colspacing=0><tr height=60 bgColor=#339900><td colspan=3 style=\"color=#FFFFFF\">目录列表:</td></tr>");
for (int i = 0; i < dir.Length; i++)
{
string href = dir[i];
href = "http://"+Request.Url.Authority.ToString() + href.Substring(href.LastIndexOf("\\"));
Response.Write("<tr onmouseout=\"this.style.backgroundColor='#ffffff'\" onmouseover=\"this.style.backgroundColor='#cccccc'\"><td> </td><td>" + dir[i] + "</td><td><a href=" + href + ">打开</a></td></tr>");
}
Response.Write("</table>");
lbTree.Text = Server.MapPath("\\");
// 在此处放置用户代码以初始化页面
} //得到当前IP
private string GetIP()
{
string[] IP_Ary;
string strIP, strIP_list;
strIP_list = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (strIP_list != null && strIP_list != "")
{
strIP_list = strIP_list.Replace("'", "");
if (strIP_list.IndexOf(",") >= 0)
{
IP_Ary = strIP_list.Split(',');
strIP = IP_Ary[0];
}
else
{
strIP = strIP_list;
}
}
else
{
strIP = "";
}
if (strIP == "")
{
strIP = Request.ServerVariables["REMOTE_ADDR"];
strIP = strIP.Replace("'", "");
}
return strIP;
}
protected void btnZip_Click(object sender, EventArgs e)
{
//压缩
String my51aspxRar;
RegistryKey my51aspxReg;
Object my51aspxObj;
String my51aspxInfo;
ProcessStartInfo my51aspxStartInfo;
Process my51aspxProcess;
try
{
my51aspxReg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRAR.exe\Shell\Open\Command");
my51aspxObj = my51aspxReg.GetValue("");
my51aspxRar = my51aspxObj.ToString();
my51aspxReg.Close();
my51aspxRar = my51aspxRar.Substring(1, my51aspxRar.Length - 7);
my51aspxInfo = "a -r -ep1 51aspx.rar " + lbTree.Text + @"rar/51aspx.txt "+ lbTree.Text + @"rar";//这里为rar的压缩命令格式(也可以自行扩展)
my51aspxStartInfo = new ProcessStartInfo();
my51aspxStartInfo.FileName = my51aspxRar;
my51aspxStartInfo.Arguments = my51aspxInfo;
my51aspxStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
my51aspxStartInfo.WorkingDirectory = lbTree.Text + "rar"; ;//获取或设置要启动的进程的初始目录。
my51aspxProcess = new Process();
my51aspxProcess.StartInfo = my51aspxStartInfo;
my51aspxProcess.Start();
Response.Write("<font color=red>压缩成功</font>");
}
catch (Exception ex)
{
Response.Write(ex.ToString());
} } protected void btnUnZip_Click(object sender, EventArgs e)
{
//解压缩
String my51aspxRar;
RegistryKey my51aspxReg;
Object my51aspxObj;
String my51aspxInfo;
ProcessStartInfo my51aspxStartInfo;
Process my51aspxProcess;
try
{
my51aspxReg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRar.exe\Shell\Open\Command");
my51aspxObj = my51aspxReg.GetValue("");
my51aspxRar = my51aspxObj.ToString();
my51aspxReg.Close();
my51aspxRar = my51aspxRar.Substring(1, my51aspxRar.Length - 7);
my51aspxInfo = " X " + lbTree.Text + @"rar/51aspx.rar " + " " + lbTree.Text + @"unRar";
my51aspxStartInfo = new ProcessStartInfo();
my51aspxStartInfo.FileName = my51aspxRar;
my51aspxStartInfo.Arguments = my51aspxInfo;
my51aspxStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
my51aspxProcess = new Process();
my51aspxProcess.StartInfo = my51aspxStartInfo;
my51aspxProcess.Start();
Response.Write("<font color=red>解压缩成功</font>");
}
catch (Exception ex)
{
Response.Write(ex.ToString());
} }
}
}