日期:2014-05-17 浏览次数:20536 次
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace SilverlightApplication1
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.Filter = "All files (*.*)|*.*";
openFileDialog1.Multiselect = false;
bool? userClickedOK = openFileDialog1.ShowDialog();
if (userClickedOK == true)
{
System.IO.Stream fileStream = openFileDialog1.File.OpenRead();
MessageBox.Show(fileStream.Length.ToString());
fileStream.Close();
}
openFileDialog1 = null;
}
}
}
------解决方案--------------------
Flash上传限制文件大小
http://demo.swfupload.org/Documentation/
File API得到文件大小
http://dotnet.aspx.cc/article/facbb9a7-c9c6-46ad-9591-5ba34ae27e58/read.aspx