using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace 上传
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public string a, b;
private void button1_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult)
{
System.IO.StreamReader r = new System.IO.StreamReader(openFileDialog1.FileName);
MessageBox.Show(r.ReadToEnd());
r.Close();
}
string FileName = openFileDialog1.SafeFileName;
// string a = DateTime.Now.ToString("yyMMddHHmmss"); textBox1.Text = FileName;
}
private void button2_Click(object sender, EventArgs e)
{
if (textBox1.Text.Trim() != "")
{
string a = DateTime.Now.ToString("yyyyMMddHHmmss");
string FileName = openFileDialog1.SafeFileName;
string filename = openFileDialog1.FileName;
string desName = Application.StartupPath + "\\upload\\";
// linkLabel2.Text = FileName;
b = desName + a + FileName;
File.Copy(filename, b, true);
}
}
}
}