你能给个能上传flv的通过测试的代码么,

解决方案 »

  1.   

    1楼说得对!!上传文件和文件类型没有关系的!!
    我做过的只能上传flv的部分代码!!
    private string ProcessBrochureUpload(FileUpload VideoUpload, out bool CancelOperation)
        {
            CancelOperation = false;    // by default, do not cancel operation        if (VideoUpload.HasFile)
            {
                // Make sure that a PDF has been uploaded
                if (string.Compare(System.IO.Path.GetExtension(VideoUpload.FileName), ".flv", true) != 0)
                {
                    UploadWarning.Text = "上传的视频文件格式不对!!只能是flv文件!!";
                    UploadWarning.Visible = true;
                    CancelOperation = true;
                    return null;
                }            const string VideoDirectory = "~/UrlData/Video/";
                string VideoPath = VideoDirectory + VideoUpload.FileName;
                string fileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(VideoUpload.FileName);            int iteration = 1;            while (System.IO.File.Exists(Server.MapPath(VideoPath)))
                {
                    VideoPath = string.Concat(VideoDirectory, fileNameWithoutExtension, "-", iteration, ".flv");
                    iteration++;
                }            // Save the file to disk and set the value of the brochurePath parameter
                VideoUpload.SaveAs(Server.MapPath(VideoPath));
                return VideoPath.Substring(1,VideoPath.Length-1);
            }
            else
            {
                // No file uploaded
                return null;
            }
        }
      

  2.   

    检查你的代码是否允许上传.flv的文件, 
    然后在你的iis的配置:在对应的网站上点右键》属性》HTT头》MIME类型》新建,扩展名:.flv ,MIME类型:.flv 
    一路确定。
    补充一下: 
    .net默认的上传文件大小是4M吧,如果超过了,请修改配置文件。如果是权限问题,请这样修改:打开iis,鼠标移到你的那个要配置的网站,点右键,选“权限”,在安全栏里选中用户“Users”,将“修改”权限打勾,一路确定。
      

  3.   

    是不是FileUpload控件有个属性控制了上传类型?