Juntoe 2015-04-24 15:44 采纳率: 0%
浏览 1497

ASP.NET视频上传功能出错谁能帮我解决一下

using System;
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 JD.Model;
using JD.BLL;

public partial class Admin_Conctrl_AddMTV : System.Web.UI.UserControl
{
int id;
MTV mtv;
protected void Page_Load(object sender, EventArgs e)
{
id = Convert.ToInt32(Request.QueryString["id"]);
if (!IsPostBack)
{
DropDownList1.DataSource = MTVTypeMananger.Get();
DropDownList1.DataBind();
}
if (id != 0)
{
mtv = MTVMananger.GetByID(id);
if (!IsPostBack)
{
TextBox1.Text = mtv.Title;
TextBox2.Text = mtv.Text;
DropDownList1.Items.FindByValue(mtv.Type.Id.ToString()).Selected = true;
CheckBox1.Checked = mtv.Order == 0 ? true : false;
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{
string mgf = string.Empty;
string filename = FileUpload1.FileName;
if (id == 0 && !FileUpload1.HasFile&&TextBox3.Text.Trim().Length==0)
{
Page.ClientScript.RegisterClientScriptBlock(GetType(), "key", "alert('请上传视频文件')", true);
return;
}
MTV b = new MTV();
if (FileUpload1.HasFile&&RadioButton2.Checked)
{
string str = filename.Substring(filename.LastIndexOf("."));
b.Url = "File/" + DateTime.Now.Ticks + str;
FileUpload1.PostedFile.SaveAs(MapPath("~/" + b.Url));
}
else if (TextBox3.Text.Trim().Length > 0 && RadioButton1.Checked)
b.Url = TextBox3.Text;
else
b.Url = mtv.Url;
b.Intime = DateTime.Now;
b.Text = TextBox2.Text;
b.Title = TextBox1.Text;
b.Order = CheckBox1.Checked ? 0 : 1;
b.Type = MTVTypeMananger.GetById(Convert.ToInt32(DropDownList1.SelectedValue));
try
{
if (id == 0)
MTVMananger.Add(b, ref mgf);
else
MTVMananger.Edit(id, b, ref mgf);
Response.Redirect("MTV.aspx?type=" + b.Type.Id);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
}

  • 写回答

1条回答 默认 最新

  • threenewbee 2015-04-24 15:47
    关注

    报什么错都不说,鬼才知道。

    评论

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条