上传文件问题
在上传大于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;
}
请教各位。