下面给定的代码我想在xml文件中打开 [英] below given code i want to open in xml file
本文介绍了下面给定的代码我想在xml文件中打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要在上传文件时在xml文件中打开
请任何人发送代码
i want open in xml file when i upload the file
plz any one send the code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Xml;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUploadControl.HasFile)
{
try
{
if (FileUploadControl.PostedFile.ContentType == "My Documents")
{
if (FileUploadControl.PostedFile.ContentLength < 102400)
{
string filename = Path.GetFileName(FileUploadControl.FileName);
FileUploadControl.SaveAs(Server.MapPath("C:\\Documents and Settings\\azhar\\My Documents\\flashrecorder.xml") + filename);
Label1.Text = "Upload status: File uploaded!";
}
else
Label1.Text = "Upload status: The file has to be less than 100 kb!";
}
else
Label1.Text = "Upload status: Files are accepted!";
}
catch (Exception ex)
{
Label1.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
}
}
}
}
推荐答案
if (FileUploadControl.HasFile)
{
try
{
if (FileUploadControl.PostedFile.ContentType == "My Documents")
{
if (FileUploadControl.PostedFile.ContentLength < 102400)
{
string filename = Path.GetFileName(FileUploadControl.FileName);
FileUploadControl.SaveAs(Server.MapPath("C:\\Documents and Settings\\azhar\\My Documents\\flashrecorder.xml") + filename);
Label1.Text = "Upload status: File uploaded!";
Response.Redirect(Server.MapPath("C:\\Documents and Settings\\azhar\\My Documents\\flashrecorder.xml
" }
else
Label1.Text = "Upload status: The file has to be less than 100 kb!";
}
else
Label1.Text = "Upload status: Files are accepted!";
}
catch (Exception ex)
{
Label1.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
}
}
这篇关于下面给定的代码我想在xml文件中打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文