FileUpload 的代码如下 如何可以上传swf动化

来源:百度知道 编辑:UC知道 时间:2024/06/25 23:21:24
protected void upload_Click(object sender, EventArgs e)
{
if (FileUp.PostedFile.ContentLength != 0)
{

if (FileUp.PostedFile.ContentType == "image/pjpeg" || FileUp.PostedFile.ContentType == "image/gif" || FileUp.PostedFile.ContentType == "image/bmp") //设置上传文件类型
{
string filename = FileUp.PostedFile.FileName; //取得文件名
int i = filename.Length;
filename = filename.Remove(0, i - 4);
string s = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString();
string d = Server.MapPath("../img/") + s + filename; //设置文件名
FileUp.PostedFile.SaveAs(d); //保存文件
txtIm

if (FileUp.PostedFile.ContentType == "image/pjpeg" || FileUp.PostedFile.ContentType == "image/gif" || FileUp.PostedFile.ContentType == "image/bmp") //设置上传文件类型

加上
FileUp.PostedFile.ContentType=="application/x-shockwave-flash"
----------------------
备注其它类型的ContentType

".*"="application/octet-stream"
".001"="application/x-001"
".301"="application/x-301"
".323"="text/h323"
".906"="application/x-906"
".907"="drawing/907"
".a11"="application/x-a11"
".acp"="audio/x-mei-aac"
".ai"="application/postscript"
".aif"="audio/aiff"
".aifc"="audio/aiff"
".aiff"="audio/aiff"
".anv"="application/x-anv"
&q