大家帮帮忙!
怎么样用C#编程,实现在网页上上传视频,音频,图象文件等
和在网页上播放视频,音频,FLASH动画等
或则希望大家能提供这方面的编程思想!
先谢谢各位高手了!
分不够再加!

解决方案 »

  1.   

    这个你看有用没有,写的比较匆忙,可能比较乱。(记得要在webconfig中添加  
    <httpRuntime maxRequestLength = "40000"/>,具体多少合适我没有测试),还有就是大文件上传有点问题。
    private Int32 UploadFile(HttpPostedFile postedFile,string strStoragePath) //new name  path
    {
       int BuffSize = 1024*4; 
       Int32 i = postedFile.ContentLength;
       string FilePath = postedFile.FileName;
       if(FilePath == "" || FilePath == null)
         Response.End();         
       string FileName = FilePath.Substring(FilePath.LastIndexOf("\\")+1);
       try
       {
        Stream fClientStream;
        FileStream fWStream;
        fClientStream = (Stream)postedFile.InputStream;
        if(File.Exists(strStoragePath)==false)  
              fWStream = new FileStream(strStoragePath,FileMode.Create);//不可覆盖      
        else return 0;//"Exist";
        int iBlock =0;
        for(;iBlock<postedFile.ContentLength/BuffSize;iBlock++)
        {
         byte[] bBuff = new byte[BuffSize];
         fClientStream.Read(bBuff,0, BuffSize);
         MemoryStream memStream = new MemoryStream(bBuff);
         memStream.WriteTo(fWStream);
         memStream.Close();
         }
         byte[] bSubBuff = new byte[postedFile.ContentLength%BuffSize];
         fClientStream.Read(bSubBuff,0, postedFile.ContentLength%BuffSize);
         MemoryStream SubStream = new MemoryStream(bSubBuff);
         SubStream.WriteTo(fWStream);
         SubStream.Close();
         fWStream.Close();
         fWStream = null;
         fClientStream.Close(); 
         }
         catch(Exception ex)
    {  
     return 0;
    }
    return i;
    }
      

  2.   

    播放视频,音频我一般都是调用mediaplay控件
    先定义一个变量:
    private string m_strAudioControl  = @"<EMBED src='@FilePath@';  height='48' width = '300' type='audio/x-wav'  loop='false' autostart='false' style=' POSITION: fixed;  '/>";
    在确定文件路径的时候用路径替换掉@FilePath@,再赋值给一个label就可以了
    LbAudio.Text =m_strAudioControl.Replace("@AudioPath@",strVirtualPath);
      //strVirtualPath就是文件对应的虚拟路径下面是页面中的相应部分
    <asp:label id="LbAudio" runat="server"></asp:label>

      

  3.   

    http://blog.csdn.net/hchxxzx/archive/2005/05/19/376362.aspx
      

  4.   

    Flash就比较复杂一点,我也是在依葫芦画瓢,在看了播放flash的页面然后反推出来的,可能不太标准。设置7个string 类型的变量就是为了整齐点,呵呵
    private string m_strFlash1 = @"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab'' width='600' height='400' id=SOredirect align='middle' SWLIVECONNECT=true>'";
    private string m_strFlash2 = @"<param name='allowScriptAccess' value='sameDomain' />"; 
    private string m_strFlash3 = @"<param name='movie' value='@FlashPath@' />";
    private string m_strFlash4 = @"<param name='quality' value='high' />";
    private string m_strFlash5 = @"<param name='bgcolor' value='#FFFFFF' />";
    private string m_strFlash6 = @"<embed src='@FlashPath@' quality='high' bgcolor='#FFFFFF' width='1' height='1' name='SOredirect' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' SWLIVECONNECT=true pluginspage='http://www.macromedia.com/go/getflashplayer' />";string strFlash = (m_strFlash1+m_strFlash2+m_strFlash3+m_strFlash4+m_strFlash5+m_strFlash6+m_strFlash7);

    LbFlash.Text =strFlash.Replace("@FlashPath@",strFlashVirtualPath);
      

  5.   

    大哥,这个还用.Net么?查查HTML的资料好了,有现成的ActiveX控件。
      

  6.   

    感谢朋友们相助!尤其是“ HuaGer(华戈) ”兄弟!
    结帖散分!