上传文件问题

xiamiwagua 2003-05-09 03:52:59
在上传大于4M的文件时,显示错误:

该页无法显示
您要查看的页当前不可用。网站可能遇到技术问题,或者您需要调整浏览器设置。

--------------------------------------------------------------------------------

请尝试以下操作:

单击刷新按钮,或以后再试。

如果您已经在地址栏中输入该网页的地址,请确认其拼写正确。

要查看连接设置,请单击工具菜单,然后单击 Internet 选项。在连接选项卡上,单击局域网设置。 这些设置应该与您局域网(LAN)管理员或 Internet 服务提供商(ISP)所提供的相匹配。
如果您的网络管理员允许,Microsoft Windows 可以检查您的网络并自动查找网络连接设置。
如果您希望 Windows 进行查找,
请单击检测网络设置。
某些站点要求 128-位的连接安全
………………………………
我实现上传的函数是codeproject.com上的那个WriteToDB;

private int WriteToDB(string strName, string strType, ref byte[] Buffer, int issue, int i_year,string mc)
{
string scategory=dcategory.SelectedItem.Value;

int nFileID = 0;
System.DateTime dtnow= new DateTime();
// Create connection
//SqlConnection myConnection = new SqlConnection("server=ZJH;database=test;Trusted_Connection=yes");

// Create Adapter
SqlDataAdapter myAdapter = new SqlDataAdapter("select * from webcontent",myConnection);

// We need this to get an ID back from the database
myAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;

// Create and initialize CommandBuilder
SqlCommandBuilder myCB = new SqlCommandBuilder(myAdapter);

// Open Connection
myConnection.Open();

// New DataSet
DataSet myDS = new DataSet();

// Populate DataSet with data
myAdapter.Fill(myDS,"webcontent");

// Get reference to our table
DataTable myTable = myDS.Tables["webcontent"];

// Create new row
DataRow myRow = myTable.NewRow();

// Store data in the row
myRow["FileSize"] = Buffer.Length;
myRow["ContentType"] = strType;
myRow["title"] = strName;
myRow["content"]= Buffer;
myRow["create_dt"]= System.DateTime.Now;
myRow["create_user"]= this.Request.QueryString["user"];
myRow["category"]= dcategory.SelectedItem.Value;

myRow["issue"]=issue;
myRow["dt_year"]=i_year;
myRow["mingcheng"]=mc;

// Add row back to table
myTable.Rows.Add(myRow);

// Update data source
myAdapter.Update(myDS,"webcontent");

// Get newFileID
if( !myRow.IsNull("FileID") )
nFileID = (int)myRow["FileID"];
// ArrayList vl= new ArrayList();
//
// DropDownList1.DataSource=myTable.Columns["title"];
// DropDownList1.DataBind();
// Close connection
myConnection.Close();

// Return FileID
return nFileID;
}


请教各位。
...全文
78 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
imfine 2003-05-09
  • 打赏
  • 举报
回复
in web.config

<httpRuntime executionTimeout="90" maxRequestLength="100000" useFullyQualifiedRedirectUrl="false" />

62,074

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧