上传问题,只要信息有价值,马上给分 比如我把文件上传到自己的服务器后,如何实现,让自己服务器的文件自动传到另一台服务器上 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个是我自己做的,应该没有什么大问题,自己看看.namespace VideoSample.上传{ /// <summary> /// inputFile 的摘要说明。 /// </summary> public class inputFile : System.Web.UI.Page { protected System.Web.UI.WebControls.Button btnUpLoad; protected System.Web.UI.HtmlControls.HtmlInputFile File1; private void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 } #region Web 窗体设计器生成的代码 override protected void OnInit(EventArgs e) { // // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。 // InitializeComponent(); base.OnInit(e); } /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.btnUpLoad.Click += new System.EventHandler(this.btnUpLoad_Click); this.Load += new System.EventHandler(this.Page_Load); } #endregion private void btnUpLoad_Click(object sender, System.EventArgs e) { string fullfileName=this.File1.PostedFile.FileName; string fileName=fullfileName.Substring(fullfileName.LastIndexOf("\\")+1); this.File1.PostedFile.SaveAs(Server.MapPath("up")+"\\"+fileName); } }} 试下这个方法可以不:=============利用SQL移动硬盘文件if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[p_movefile]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[p_movefile]GO/*--移动服务器上的文件 不借助 xp_cmdshell ,因为这个在大多数时候都被禁用了--邹建 2004.08(引用请保留此信息)--*//*--调用示例 exec p_movefile 'd:\aa.txt','c:\'--*/create proc p_movefile@s_file varchar(1000), --源文件@d_file varchar(1000) --目标文件asdeclare @err int,@src varchar(255),@desc varchar(255)declare @obj intexec @err=sp_oacreate 'Scripting.FileSystemObject',@obj outif @err<>0 goto lberrexec @err=sp_oamethod @obj,'MoveFile',null,@s_file,@d_fileif @err<>0 goto lberrexec @err=sp_oadestroy @objreturnlberr: exec sp_oageterrorinfo 0,@src out,@desc out select cast(@err as varbinary(4)) as 错误号 ,@src as 错误源,@desc as 错误描述go拷貝文件就是將MoveFile 改成CopyFile就可以了。 急急急急急!!!! 怎么在自己的 网站页面上 动态显示服务器 上的东西呢? 高手解答 .net3.0、3.5是否兼容2.0 急急急急急急急急急急急急急急急急急急急急急急急急急急 弹出警告框,但是不让页面刷新。 asp.net2.0中用dataset读xml文档为什么中文读不出来呢,英文就可以! 读取并显示rss的时候,如何处理rss不同版本的情况? 请教:为什么显示服务器应用程序不可用 为什么我的.net快速入门不能用? 在C#中如何动态改变调用的COM控件的属性(如大小设置) 怎样将页面表格及表格内容导出到word 撒个分,顺便问个atlas的问题,用过的兄弟帮看看 一个关于sql的语句
namespace VideoSample.上传
{
/// <summary>
/// inputFile 的摘要说明。
/// </summary>
public class inputFile : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button btnUpLoad;
protected System.Web.UI.HtmlControls.HtmlInputFile File1;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
} #region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.btnUpLoad.Click += new System.EventHandler(this.btnUpLoad_Click);
this.Load += new System.EventHandler(this.Page_Load); }
#endregion private void btnUpLoad_Click(object sender, System.EventArgs e)
{
string fullfileName=this.File1.PostedFile.FileName;
string fileName=fullfileName.Substring(fullfileName.LastIndexOf("\\")+1);
this.File1.PostedFile.SaveAs(Server.MapPath("up")+"\\"+fileName);
}
}
}
=============
利用SQL移动硬盘文件if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[p_movefile]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[p_movefile]
GO/*--移动服务器上的文件 不借助 xp_cmdshell ,因为这个在大多数时候都被禁用了--邹建 2004.08(引用请保留此信息)--*//*--调用示例 exec p_movefile 'd:\aa.txt','c:\'
--*/
create proc p_movefile
@s_file varchar(1000), --源文件
@d_file varchar(1000) --目标文件
as
declare @err int,@src varchar(255),@desc varchar(255)
declare @obj intexec @err=sp_oacreate 'Scripting.FileSystemObject',@obj out
if @err<>0 goto lberrexec @err=sp_oamethod @obj,'MoveFile',null,@s_file,@d_file
if @err<>0 goto lberrexec @err=sp_oadestroy @obj
returnlberr:
exec sp_oageterrorinfo 0,@src out,@desc out
select cast(@err as varbinary(4)) as 错误号
,@src as 错误源,@desc as 错误描述
go拷貝文件就是將MoveFile 改成CopyFile就可以了。