C# 删除PhotoUploader.cs
请帮助我,我想删除此代码中的PhotoUploader.cs:C# 删除PhotoUploader.cs,c#,asp.net,C#,Asp.net,请帮助我,我想删除此代码中的PhotoUploader.cs: protected void RadButton39_Click(object sender, EventArgs e) { try { HttpFileCollection uploadedFiles = Request.Files; PhotoUploader uploader = new PhotoUploader(); for (int i = 0; i &
protected void RadButton39_Click(object sender, EventArgs e)
{
try
{
HttpFileCollection uploadedFiles = Request.Files;
PhotoUploader uploader = new PhotoUploader();
for (int i = 0; i < uploadedFiles.Count; i++)
{
HttpPostedFile userPostedFile = uploadedFiles[i];
if (userPostedFile.ContentLength > 0)
{
using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
{
uploader.StartUploadProcess(userPostedFile, 210, "~/Img/News/");
string small_pic_name = uploader.LastImageName;
uploader.StartUploadProcess(userPostedFile, 650, "~/Img/News/");
string big_pic_name = uploader.LastImageName;
string commandText = "INSERT INTO NewsGallery(ID, Small_pic, Big_pic) VALUES ('" + int.Parse(GridView1.SelectedDataKey.Value.ToString()) + "','" + small_pic_name + "', '" + big_pic_name + "')";
SqlCommand command = new SqlCommand(commandText, connection);
connection.Open();
int rowsAffected = command.ExecuteNonQuery();
if (rowsAffected == 1)
{
// MessageLabel.Text = "";
}
connection.Close();
}
}
GridView1.DataBind();
GridView2.DataBind();
}
}
catch { }
}
protectedvoid RadButton39\u单击(对象发送方,事件参数e)
{
尝试
{
HttpFileCollection uploadedFiles=Request.Files;
PhotoUploader uploader=新的PhotoUploader();
对于(int i=0;i0)
{
使用(SqlConnection连接=新的SqlConnection(ConfigurationManager.ConnectionString[“ConnectionString”].ConnectionString))
{
uploader.StartUploadProcess(userPostedFile,210,“~/Img/News/”;
字符串small\u pic\u name=uploader.LastImageName;
uploader.StartUploadProcess(userPostedFile,650,“~/Img/News/”;
字符串big\u pic\u name=uploader.LastImageName;
string commandText=“插入到新闻库(ID、小图片、大图片)值(“+int.Parse(GridView1.SelectedDataKey.Value.ToString())+”、“+Small图片名称+”、“+Big图片名称+”);
SqlCommand=newsqlcommand(commandText,connection);
connection.Open();
int rowsAffected=command.ExecuteNonQuery();
如果(rowsAffected==1)
{
//MessageLabel.Text=“”;
}
connection.Close();
}
}
GridView1.DataBind();
GridView2.DataBind();
}
}
捕获{}
}
我想返回到asp.net中的正常上载程序
如何实现这一点?在这里,
PhotoUploader
类有一些专有方法(例如,StartUplaodProcess
)正在代码中使用。首先,我们需要知道这些函数在做什么。然后,只有它将是可能的,以取代整个代码与正常的ASP上传控制。你是使用无线电控制从Telerik用户界面?