多个图片文件压缩成zip(rar)
通过网页上传文件都服务器
服务器解压文件并获取里面的图片数据
分成一个一个图片文件并保存能做到吗
通过网页上传文件都服务器
服务器解压文件并获取里面的图片数据
分成一个一个图片文件并保存能做到吗
解决方案 »
- 如何实现一个SqlDataSource中返回多个表
- Microsoft 论坛怎么不能登录了?
- 发新贴测试一下
- Asp.net 1.1 中,用如下代码在c#中递交并重定向下一页 ***********100 分*************
- DataTable导出数据到excel后,单击页面上的一些web控件(autopostback为true)会出错
- 生成静态页面后,不知道怎么在静态页面里加评论
- ASP.NET出错了,麻烦大家了!
- 请问如何配置.NET系统?
- 用过Freetextbox的进来!!
- 求一用access数据库连接并在 DataGrid里显示的代码。
- 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());
} }
}
}