你用的是jspSmartUpload吗?如果是,用其自带的Sample2的方法可以upload大文件,Sample1的方法不行。

解决方案 »

  1.   

    我这里有一个程序,原来也是不能够上传大文件,后来改了WEB.CONFIG就可以了,我用的是UpLoadFile,我把上传流和下载做到一块方便调试而已 private void upLoadButton_Click(object sender, System.EventArgs e)
    {
    string upLoadFileName;
    // string upLoadFilePath;
    // string upLoadFileToDir;// upLoadFileToDir="D:\\UpLoad_Files\\";

    //返回的是通过文件对话框选择的文件名,这之中包含了文件的目录信息
    upLoadFileName=upLoadFile.PostedFile.FileName;
    //去掉目录信息,返回文件名称
    upLoadFileName=Path.GetFileName(upLoadFileName);// if (!Directory.Exists(upLoadFileToDir))
    //
    // //如果目录不存在,则创建一个
    // Directory.CreateDirectory(upLoadFileToDir);
    //
    // //得到上传目录及文件名称
    // upLoadFilePath=upLoadFileToDir+upLoadFileName;

    //获得并显示上传文件的属性

    if (upLoadFile.PostedFile.ContentLength > 4194304)
    {
    string strShut;
    strShut = "<Script language=javascript>\r\n        alert('";
    strShut = strShut+"文件不得大于4M";
    strShut = strShut+"')\r\n </Script>\r\n";
    Page.RegisterStartupScript("strShut",strShut);
    exit sub;
    }
    else
    {
    // upLoadFile.PostedFile.SaveAs(upLoadFilePath);
    }
    //获得文件名称
    fileNameLabel.Text=upLoadFileName; //获得文件类型
    fileTypeLabel.Text=upLoadFile.PostedFile.ContentType; //获得文件长度
    fileTypeLabel.Text=upLoadFile.PostedFile.ContentLength.ToString(); RequiredFieldValidator1.Text="恭喜您,上传文件成功!";

    //将文件存为数据库字节流
    byte[] fsData = new byte[upLoadFile.PostedFile.InputStream.Length];
    upLoadFile.PostedFile.InputStream.Read (fsData,0,(int)upLoadFile.PostedFile.InputStream.Length );
    upLoadFile.Dispose ();
    //在服务器生成附件
    // string cc="d:\\"+fileNameLabel.Text;
    // FileStream fout = new FileStream (cc,FileMode.OpenOrCreate  ,FileAccess.Write );

    //将数据库字节流写入客户端文件
    Response.AppendHeader("Content-Disposition","attachment; filename="+Server.UrlEncode (fileNameLabel.Text));
    Response.BinaryWrite(fsData);
    Response.End();web.config 添加如下说明
    <httpRuntime maxRequestLength="xxxx"
              useFullyQualifiedRedirectUrl="true"
              executionTimeout="45"
       />
    xxxx是你要限制的上传文件大小
      

  2.   

    好像需要该webconfig文件中的一些参数:
    <system.web>
      <httpRuntime maxRequestLength="1000000000"    useFullyQualifiedRedirectUrl="true"     executionTimeout="145"/>
    后面添全就行了,第一行就是限制大小的
      

  3.   

    tomcat??
    目前.net可以运行在tomcat上吗?
      

  4.   

    ???
    目前.net可以运行在tomcat上吗??
      

  5.   

    ???
    目前.net可以运行在tomcat上吗??