⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 upmusic.aspx.cs

📁 1、用SQL查询器打开install目录下的dooogo.sql运行之后创建数据库dooogo。 2、然后打开web.config修改 <DbProvider type="Club.Fram
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Text;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Xml;
using Bestcomy.Web.Controls.Upload;
using Club.Framework;
using Club.Framework.Components;
using Club.Framework.Configuration;
using Club.Framework.Data;
namespace Club.ClubManage
{
	/// <summary>
	/// WebForm1 的摘要说明。
	/// </summary>
	public class upMusic : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.TextBox box_comments;
		protected System.Web.UI.WebControls.Button btn_upload;
		protected System.Web.UI.WebControls.Panel Panel2;
		protected System.Web.UI.WebControls.Panel Panel1;
		protected System.Web.UI.WebControls.Label txt_result;
		protected int RegisterId
		{
			get
			{
				if(FormSecurity.GetAdminLoginId()!=0)
				{
					return FormSecurity.GetAdminLoginId();
				}
				return FormSecurity.GetMemberId();
			}
		}
		private c_UserDataCountInfo userDataCount;
		public c_UserDataCountInfo UserDataCount
		{
			get
			{
				return this.userDataCount;
			}
		}
		private c_HomeSettingInfo setting;
		public c_HomeSettingInfo Setting
		{
			get
			{
				return this.setting;
			}
		}
		private void Page_Load(object sender, System.EventArgs e)
		{
			if(!FormSecurity.IsAuthenticated())
			{
				throw new AdminException("对不起,您没有登陆不能使用此功能!",Globals.UrlFormats.Home());
			}
			AspnetUpload upldr = new AspnetUpload();
			upldr.RegisterModelessProgressBar(btn_upload);
			string fpath = Globals.GetFilePath(Config.ClubPhotoCache);
			if(!Directory.Exists(fpath))
				Directory.CreateDirectory(fpath);
			upldr.set_UploadFolder(fpath);
			//upldr.set_MaxRequestLength(Config.Settings.UpMusicMaxLength);//KB;
			if(this.Request.QueryString["Show"]=="False")
			{
				this.Panel1.Visible=false;
				this.Panel2.Visible=true;
			}
			else
			{

				this.Panel1.Visible=true;
				this.Panel2.Visible=false;


			}
		}
		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.btn_upload.Click += new System.EventHandler(this.btn_upload_Click);
			this.Load += new System.EventHandler(this.Page_Load);
		}
		#endregion

		private void btn_upload_Click(object sender, System.EventArgs e)
		{
			this.userDataCount = Globals.DbProvider.GetUserCountInfo(this.RegisterId);
			this.setting=Globals.DbProvider.Select_c_HomeSettingByRegisterID(this.RegisterId);
			if(this.setting==null)
			{
				this.setting=new c_HomeSettingInfo();
			}
			string musicPath=Globals.GetFilePath(Config.ClubMusicPath);
			if(Config.Settings.UpFileIsMakeDir)
			{
				musicPath=musicPath+this.RegisterId+"\\";
				FileHelper.AddFolder(musicPath);
			}
			string filename=string.Empty;
			foreach(UploadFile file in AspnetUpload.GetUploadFiles("file1"))
			{
				filename=StringHelper.GetDataRandom();
				string ex_Name=StringHelper.GetLastStr(Path.GetFileName(file.get_FileName()),".");
				long fileLength=file.get_ContentLength();
				filename=filename+"."+ex_Name;
				file.SaveAs(musicPath+filename);
				if((this.userDataCount.UseCapabilitySize+fileLength)/1048576.0>this.setting.CapabilitySize)
				{
					Page.RegisterClientScriptBlock("showMsg",Globals.Javascript.getScriptContent("alert('你的个人空间已满,请升级空间或删除一些图片或音乐!');parent.window.close();"));
					FileHelper.DelFileExe(musicPath+filename);
					return ;
				}
				if(StringHelper.GetStrCount("asf,asx,wma,wmx,wmv,wvx,mp3,wav,mid",ex_Name.ToLower().Trim())==0)
				{
					Page.RegisterClientScriptBlock("showMsg",Globals.Javascript.getScriptContent("alert('请上传asf,asx,wma,wmx,wmv,wvx,mp3,wav,mid格式的音乐!');parent.window.close();"));
					FileHelper.DelFileExe(musicPath+filename);
					return ;
				}
				if(fileLength>(Config.Settings.UpMusicMaxLength*1024))
				{
					Page.RegisterClientScriptBlock("showMsg",Globals.Javascript.getScriptContent("alert('请上传小于(Config.Settings.UpMusicMaxLength/1024)MB的音乐!');parent.window.close();"));
					FileHelper.DelFileExe(musicPath+filename);
					return ;
				}
				break;
			}
			string scriptString=Globals.Javascript.getScriptContent("upFileFinish('"+filename+"')");
			Page.RegisterClientScriptBlock("returnValue",scriptString);
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -